-
-
Save RX14/e79134d1d9964334d6c111e9a5193c90 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private def to_timeval(time : Time::Span) | |
t = uninitialized LibC::Timeval | |
seconds, remainder_ticks = time.ticks.divmod(Time::Span::TicksPerSecond) | |
t.tv_sec = typeof(t.tv_sec).new(seconds) | |
t.tv_usec = typeof(t.tv_usec).new(remainder_ticks / Time::Span::TicksPerMicrosecond) | |
t | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment