On Wed, Apr 11, 2018 at 12:11 PM, Tomas Hajny <xhaj...@hajny.biz> wrote: > On Wed, April 11, 2018 18:44, R0b0t1 wrote: > > . > . >> This is related to something I meant to propose a while >> ago related to a cross platform timing and alarm API. >> I do not think GetTickCount should ever be used; >> instead, QueryPerformanceCounter makes more sense. It is >> higher resolution and still portable. The Linux function >> `clock_gettime` called with `CLOCK_REALTIME_HR` is more >> or less a direct equivalent. > > No, it isn't portable (neither is GetTickCount, BTW) - there are many more > targets supported by FPC than MS Windows and Linuxm >
My apologies, I meant portable between Windows versions. Various high resolution timing facilities on Windows that are not QueryPerformanceCounter give wildly varying results based on many factors, usually hardware. `clock_gettime` is supported by Linux and FreeBSD, which now includes recent macOS versions. If it is not supported, `gettimeofday` can be used instead at a lower resolution. There are also timing facilities based on events that are fairly uniform in interface construction. Keep in mind that newer timing functions tend to have a noticeable decrease in resource usage compared to newer ones. The event based timers are very nice because constant switches into libc are not necessary. Cheers, R0b0t1 > Tomas > > > _______________________________________________ > fpc-pascal maillist - fpc-pascal@lists.freepascal.org > http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal