Fix compile on glibc
authorRoy Marples <roy@marples.name>
Tue, 2 Sep 2014 21:27:42 +0000 (21:27 +0000)
committerRoy Marples <roy@marples.name>
Tue, 2 Sep 2014 21:27:42 +0000 (21:27 +0000)
src/dhcpcd-online/dhcpcd-online.c

index 334960ca4ba98b1464cf49972ebdddeb254a9ac9..ba04ebdb26bf95c303e8647f0c0f162ca5172d66 100644 (file)
 # endif
 #endif
 
+#ifndef timespeccmp
+#define        timespeccmp(tsp, usp, cmp)                                      \
+       (((tsp)->tv_sec == (usp)->tv_sec) ?                             \
+           ((tsp)->tv_nsec cmp (usp)->tv_nsec) :                       \
+           ((tsp)->tv_sec cmp (usp)->tv_sec))
+#endif
+#ifndef timespecsub
+#define        timespecsub(tsp, usp, vsp)                                      \
+       do {                                                            \
+               (vsp)->tv_sec = (tsp)->tv_sec - (usp)->tv_sec;          \
+               (vsp)->tv_nsec = (tsp)->tv_nsec - (usp)->tv_nsec;       \
+               if ((vsp)->tv_nsec < 0) {                               \
+                       (vsp)->tv_sec--;                                \
+                       (vsp)->tv_nsec += 1000000000L;                  \
+               }                                                       \
+       } while (/* CONSTCOND */ 0)
+#endif
+
 static void __dead
 do_exit(DHCPCD_CONNECTION *con, int code)
 {