Best way to convert between chrono::Duration and libc::timeval?

Hi,

What's the best way to convert between chrono::Duration and libc::timeval? The main problem is that the internal struct elements of Duration are private and there is no clean way to get access to just the sub-second nanoseconds element.
You could rely on the Duration.num_microseconds(), but that requires handling the possible exception which is only due to combining both the second and the sub-seccond parts of the struct.

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.