[Lazarus] Portable way to get accurate timestamps?

Sven Barth pascaldragon at googlemail.com
Fri Feb 25 12:45:31 CET 2011


Am 24.02.2011 08:22, schrieb Graeme Geldenhuys:
> Op 2011-02-23 18:56, Luca Olivetti het geskryf:
>> BTW: in which unit are clock_gettime and related constants defined?
>
> libc   (FPC wrapper to the libc library)
>
> ...more specifically...
>
> packages/libc/src/timeh.inc

No, no, no and again no.

Don't suggest anyone to use the unit libc. It's only there for 
compatibilty for Kylix and works only on i386-linux. If someone wants to 
have "clock_gettime" then a "fpclock_gettime" should be added to e.g. 
"baseunix" or "linux" which uses the "syscall_nr_clock_gettime" syscall.

>
> I wonder if we can't use Petr's GetTickCount() implementation as default
> for FPC+Linux/BSD? Anybody raised this question to the FPC developers?

But as a fallback for 2.4 kernels the old Now variant could be used.

Regards,
Sven




More information about the Lazarus mailing list