From: David Lamparter Date: Mon, 23 Jan 2017 22:17:35 +0000 (+0100) Subject: lib: time: add TIMEVAL_TO_TIMESPEC X-Git-Tag: frr-3.0-branchpoint~64^2~9^2 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=39cea8220a9bcc51d97a7832760591e117cdde7a;p=matthieu%2Ffrr.git lib: time: add TIMEVAL_TO_TIMESPEC Should be in system headers, but not specified by any standard. Not currently used anywhere yet. Signed-off-by: David Lamparter --- diff --git a/lib/monotime.h b/lib/monotime.h index 10d3bb604d..0fd4940431 100644 --- a/lib/monotime.h +++ b/lib/monotime.h @@ -28,6 +28,13 @@ (tv)->tv_usec = (ts)->tv_nsec / 1000; \ } while (0) #endif +#ifndef TIMEVAL_TO_TIMESPEC +/* should be in sys/time.h on BSD & Linux libcs */ +#define TIMEVAL_TO_TIMESPEC(tv, ts) do { \ + (ts)->tv_sec = (tv)->tv_sec; \ + (ts)->tv_nsec = (tv)->tv_usec * 1000; \ + } while (0) +#endif static inline time_t monotime(struct timeval *tvo) {