RE: [Boost-Users] Using date_time::microsec_clock in windows ?
Jérôme Poulin wrote:
How do you guys suggest to emulate the microsec_clock on a Windows compilation ? I don't know how the boost developers are planning on it, but the NTP (Network Time Protocol) uses the high performance counter functions (QueryHighPerformanceCounter and QueryHighPerformanceFrequency, IIRC) and interpolates based on that.
-- Jim
Jim.Hyslop wrote:
I don't know how the boost developers are planning on it, but the NTP (Network Time Protocol) uses the high performance counter functions (QueryHighPerformanceCounter and QueryHighPerformanceFrequency, IIRC) and interpolates based on that.
We discussed this a few months back. I don't think you can use these because they only give a relative time, there is no way (that I know of) to convert a performance count into an actual date/time. It can be used for elapsed time, but not, AFAIK, for absolute time. FWIW, I implemented a solution for Borland back then and posted it here. But we also discussed calling it millisec_clock since it doesn't actually give microsec accuracy. I can't remember what the outcome was. Cheers Russell static time_type local_time() { #ifdef __BORLANDC__ SYSTEMTIME lt; GetLocalTime(<); date_type d = date_type(lt.wYear, lt.wMonth, lt.wDay); int adjust = resolution_traits_type::res_adjust() / 1000; time_duration_type td = time_duration_type(lt.wHour, lt.wMinute, lt.wSecond, lt.wMilliseconds * adjust); return time_type(d, td); #else .... #endif }
participants (2)
-
Jim.Hyslop
-
Russell Hind