Fix compile on Linux.
[dhcpcd-ui] / src / dhcpcd-curses / common.h
index aeb1ccfc3a607d7e6242e12b5ab549610ef92408..ea46b6d97fb304b01bce730bc1baaafddf2a2d35 100644 (file)
 #define MSEC_PER_SEC           1000L
 #define MSEC_PER_NSEC          1000000L
 
+#ifndef TIMEVAL_TO_TIMESPEC
+#define        TIMEVAL_TO_TIMESPEC(tv, ts) do {                                \
+       (ts)->tv_sec = (tv)->tv_sec;                                    \
+       (ts)->tv_nsec = (tv)->tv_usec * USEC_PER_NSEC;                  \
+} while (0 /* CONSTCOND */)
+#endif
+
 /* Some systems don't define timespec macros */
 #ifndef timespecclear
 #define timespecclear(tsp)      (tsp)->tv_sec = (time_t)((tsp)->tv_nsec = 0L)