
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...
I also noticed that getimeofday() wasn't checked for failure in the current boost headers.
I also fell on a page which stated that "On Windows, clock() returns the nearest approximation to wall-clock time since the first call to this function, based on the Win32 function QueryPerformanceCounter(). The resolution is typically better than one microsecond.". While I doubt it it might be interesting for our problem if it happen to be true.
After the suggestions & having read the wiki I think we should indeed modifiy parts of date_time and template the timer class like mentionned. Should I try to give it a go ?
I guess it depends what the class is supposed to do: whether it measures real-world time, or some performance metric that isn't really time related. John.