RE: GNULib Module gettime Breaks CVS Build On Windows

"Jim.Hyslop" <[email protected]> Wed, 12 May 2004 10:22:14 -0400
Newsgroups gmane.comp.lib.gnulib.bugs,gmane.comp.version-control.cvs.bugs
Message-ID <[email protected]>
Derek Robert Price wrote:
> Jim.Hyslop wrote:
> 
> >The implementation looks reasonable on a quick glance (I haven't
> checked it
> >in detail), but one thing you should be aware of is that, 
> although the
> >FILETIME is capable of containing times on the order of 
> hectonanoseconds,
> >the operating system only refreshes the time returned every 10.4
> >milliseconds or so. This function will *not* give you a 
> high-resolution
> >time.
> 
> 
> Hi Jim!
> 
> Are you aware of any function available on Windows that _does_ yield a
> high resolution time?  Preferrably one based on some standard, such as
> C89, C99, or POSIX?

Unfortunately, no, I'm not aware of any. It appears that all the high-level
functions use the system timer resolution of 10 ms.

NTP (www.ntp.org) hacks around it by using the Windows
QueryPerformanceCounter() and QueryPerformanceFrequency() functions, which
yield a resolution around 300 ns (on my machine, at least).

BTW, I'm also experimenting with the select() workaround (to overcome
Sleep()'s 10 ms granularity) - just in case this is another function that
accepts a high-resolution input but makes it lower resolution under the
hood. I'll post the results as soon as I have finished.


-- 
Jim Hyslop
Senior Software Designer
Leitch Technology International Inc. (http://www.leitch.com)
Columnist, C/C++ Users Journal (http://www.cuj.com/experts)