I would like to obtain the time with millisecond precision using Boost. (The accuracy does not need to be millisecond, just close.)
Referring to Local time with milliseconds, and others, it is indicated that the microsecond clock should be used:
boost::posix_time::microsec_clock::local_time();
In my experience, it is impossible to obtain time to a precision of microseconds (assuming some similar accuracy) with the standard, low-impact system calls (i.e., ::GetTicks()
on Windows). Rather, CPU-intensive calls need to be issued to improve the accuracy beyond milliseconds (into microseconds).
As I mentioned, I don't need microsecond precision - just somewhat close to millisecond precision. However, Boost.Date_Time does not provide any "millisec_clock" - it provides a second_clock
, and the next gradation is microsec_clock
, with no "millisec_clock" in between.
If I use the microsec_clock
, as noted, to obtain MILLIseconds, will I be hit with a CPU-intensive call?