Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2006-05-15 13:26:16

John Maddock wrote:
> Silex wrote:
>> I found out that there's already
>> <boost/date_time/microsec_time_clock.hpp>, but on windows it uses
>> GetSystemTimeAsFileTime().
>> This raises a potential issue: I don't know if
>> GetSystemTimeAsFileTime() works at millisecond resolution like
>> QueryPerformanceCounter() does, and I don't know if
>> QueryPerformanceCounter() returns some kind of epoch.. the docs are
>> rather lowly-documented on this.
> Ah, I suspect there may be problems with the CPU clock changing speed
> with some of these timers, I'm not sure though...

The problem with GetSystemTimeAsFileTime is that it can jump an hour
forward/backward as DST kicks in/out.

The problem with QueryPerformanceCounter is that QueryPerformanceFrequency
is not (AFAIK) required to return the same value every time. It may be CPU
clock based, and a low power CPU can vary its frequency depending on load.

We don't have a good TIME_MONOTONIC solution, and we really do need one for
the threading library.

FWIW, I have found timeGetTime pretty reliable on Windows as a monotonic
time provider. It only has 1ms resolution, though.

Boost list run by bdawes at, gregod at, cpdaniel at, john at