Created
December 27, 2012 00:15
-
-
Save enjoylife/4384268 to your computer and use it in GitHub Desktop.
convert timespec structures to timeval and vice versa.
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
#ifndef TIMEVAL_TO_TIMESPEC | |
#define TIMEVAL_TO_TIMESPEC(tv, ts) \ | |
do { \ | |
(ts)->tv_sec = (tv)->tv_sec; \ | |
(ts)->tv_nsec = (tv)->tv_usec * 1000; \ | |
} while (0) | |
#endif | |
#ifndef TIMESPEC_TO_TIMEVAL | |
#define TIMESPEC_TO_TIMEVAL(tv, ts) \ | |
do { \ | |
(tv)->tv_sec = (ts)->tv_sec; \ | |
(tv)->tv_usec = (ts)->tv_nsec / 1000; \ | |
} while (0) | |
#endif |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment