]> git.puffer.fish Git - mirror/frr.git/commitdiff
lib: time: add TIMEVAL_TO_TIMESPEC 104/head
authorDavid Lamparter <equinox@opensourcerouting.org>
Mon, 23 Jan 2017 22:17:35 +0000 (23:17 +0100)
committerDavid Lamparter <equinox@opensourcerouting.org>
Mon, 23 Jan 2017 22:17:35 +0000 (23:17 +0100)
Should be in system headers, but not specified by any standard.
Not currently used anywhere yet.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
lib/monotime.h

index 10d3bb604db5afb77cfe6995c229c8e8ab92c624..0fd49404311b8e51f35f92f8cd53bab926095423 100644 (file)
        (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)
 {