[LEAPSECS] Coding this week, and a trick for timeouts over leap seconds.
Tom Van Baak
tvb at LeapSecond.com
Fri Oct 14 11:39:21 EDT 2011
> BTW Windows has QueryPerformanceCounter(). However much as I like Unix
> clock() and clock_gettime(CLOCK_MONOTONIC), I'm stuck with the problem
> that there are many third party libraries with which I link and much
> code written by other teams that I have no idea about.
Note that QueryPerformanceCounter may run at a different
rate than clock() or time() or GetSystemTime(), etc. On my
PC, at least, QueryPerformanceCounter is derived from the
1.193 MHz ISA clock and not the TOD or interrupt clock. So
not only is it immune from time set changes (including NTP)
but it will also naturally drift by seconds over a day. This is
not a problem for short-term timeouts, but something to note
if using these alternative APIs for timekeeping.
> Any one of those components (some of which run on other machines to
> my code - to which I communicate over the network) could have a false
> 1 second delay.
>
> So it still seems the best way is to assume the delay might be there
> and to program defensively. *shrug*
>
> -paul
Yeah, I don't know how to solve the third party issue either.
/tvb
More information about the LEAPSECS
mailing list