This is the mail archive of the
cygwin@cygwin.com
mailing list for the Cygwin project.
gettimeofday resolution
- To: cygwin at cygwin dot com
- Subject: gettimeofday resolution
- From: Greg Smith <gsmith at nc dot rr dot com>
- Date: Thu, 11 Oct 2001 18:33:22 -0400
I couldn't help but notice that gettimeofday() returns the
same value for every 10ms time tick (times.cc is using
GetSystemTimeAsFileTime). One of our developers noted that
there are win32 functions QueryPerformanceFrequency and
QueryPerformanceCounter that can be used to gain microsecond
resolution at low cost.
(See http://msdn.microsoft.com/library/en-us/winui/timers_6mk9.asp
and http://msdn.microsoft.com/library/en-us/winui/timers_4z76.asp).
These apparently reference a 64 bit counter called RDTSC present
in pentium class processors (and above). I am also told that
this is the method linux uses on intel to achieve microsecond
resolution.
I know, I know. I'll try to make it as few lines as possible ;-)
Greg
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Bug reporting: http://cygwin.com/bugs.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/