Subject: Re: [boost] date_time using CPU performance counter
From: Ilya Bobyr (ilya.bobir_at_[hidden])
Date: 2011-11-17 14:52:41
On 11/17/2011 1:28 PM, Kenneth Porter wrote:
> I need high precision under Windows XP but don't need long-term date
> accuracy. To that end, I think it would be useful to have a microsec_clock
> implemented in terms of the Windows QueryPerformanceCounter API (which
> wraps a CPU register query) instead of the GetSystemTimeAsFileTime API
> (which is only good to 15 msecs and almost guarantees a context switch).
> Has anyone attempted this? How hard is it to code up a new clock source to
> fit into the Boost date_time design?
My guess is that the tricky part lies in the fact that
QueryPerformanceCounter returns a rather arbitrary number. You may
convert a difference between two such numbers to a real time duration
but it does not seem to be trivial to convert one number to a real time
I think this is the reason GetSystemTimeAsFileTime fits date_time design
better than the QueryPerformanceCounter.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk