[LEAPSECS] Coding this week, and a trick for timeouts over leap seconds.

Tony Finch dot at dotat.at
Mon Oct 3 07:19:53 EDT 2011


Tom Van Baak <tvb at LeapSecond.com> wrote:

>

> Try using clock() instead of gettimeofday_in_millisecs(). The former

> nicely increments with CLOCKS_PER_SEC resolution and is immune

> from UTC, timezones, and leap seconds. At least it does on windows.

> Can someone comment on unix/linux?


clock() is broken on Windows in order to be backwards-compatible with DOS.
It is supposed to return the time the process has spent running on the
CPU, which is traditionally rather slower than real time, though it may be
faster for a multithreaded process on a multicore computer. Since DOS
didn't multitask it just returned elapsed time since the process started,
and Windows has retained this braindamaged semantics.

Tony.
--
f.anthony.n.finch <dot at dotat.at> http://dotat.at/
Trafalgar: Variable or easterly, 3 or 4, increasing 5 to 7 for a time in far
southeast of Trafalgar. Slight or moderate. Showers, fog patches. Moderate or
good, occasionally very poor.


More information about the LEAPSECS mailing list