7 #include "wvtimeutils.h"
16 long long secdiff = a.tv_sec - b.tv_sec;
17 long long usecdiff = a.tv_usec - b.tv_usec;
18 long long msecs = secdiff * 1000 + usecdiff / 1000;
23 else if (msecs < INT_MIN)
42 b.tv_sec = a.tv_sec + msec / 1000;
43 b.tv_usec = a.tv_usec + (msec % 1000) * 1000;
52 c.tv_sec = a.tv_sec - b.tv_sec;
53 c.tv_usec = a.tv_usec;
55 if (b.tv_usec > a.tv_usec)
61 c.tv_usec -= b.tv_usec;
68 static WvTime wvstime_cur = wvtime();
77 static void do_wvstime_sync(
bool forward_only)
81 wvstime_cur = wvtime();
86 if (wvstime_cur < now)
94 do_wvstime_sync(
false);
98 void wvstime_sync_forward()
100 do_wvstime_sync(
true);
104 void wvstime_set(
const WvTime &_new_time)
106 wvstime_cur = _new_time;
110 void wvdelay(
int msec_delay)
115 usleep(msec_delay * 1000);