You can also use the QueryPeformanceCounter and related functions for better precision.

From: Mark Sims

Heather's gotta work with XP (and maybe Win98)... too many people (including me) run it on old trashy laptops, so no fancy pants new fangled Windoze calls allowed...

In the past I've avoided the use of QueryPerformanceCounter due to potential issues with AMD processors, multi-core processors and multi-processor systems, inaccurate/invalid reported CPU clock frequency (TSC tick count divisor) values, variable clock rate systems, etc. I'm now back to using it, but have added an option for switching back to GetTickCount() and it's 16 msec granularity. I'm getting very good results so far.
_______________________________________________

Mark,

You can easily use the new functions if they are available simply by asking Kernel32.dll whether it knows about them. If not, use the old function, if so, use the new. The result from old and new is identical in format, just better in precision in the newer.



==================================
var
 FPreciseFT: procedure (var lpSystemTimeAsFileTime: TFileTime); stdcall;

begin
 FKernel32 := LoadLibrary ('kernel32.dll');
 if FKernel32 <> 0 then
   begin
FPreciseFT := GetProcAddress (FKernel32, 'GetSystemTimePreciseAsFileTime');
   if @FPreciseFT = nil then
     FPreciseFT := GetProcAddress (FKernel32, 'GetSystemTimeAsFileTime');
   FreeLibrary (FKernel32);
   end;
end.
==================================

Cheers,
--
SatSignal Software - Quality software written to your requirements
Web: http://www.satsignal.eu
Email: david-tay...@blueyonder.co.uk
Twitter: @gm8arv
_______________________________________________
time-nuts mailing list -- time-nuts@febo.com
To unsubscribe, go to https://www.febo.com/cgi-bin/mailman/listinfo/time-nuts
and follow the instructions there.

Reply via email to