[Lazarus] Better implementation of GetTickcount using clock_gettime

zeljko zeljko at holobit.net
Tue Apr 1 12:45:54 CEST 2014


On 04/01/2014 12:20 PM, Luca Olivetti wrote:

> For linux a more accurate implementation could be
>
> function GetTickCount64: QWord;
> var
>    tp: timespec;
> begin
>    clock_gettime(CLOCK_MONOTONIC, @tp);
>    Result := (Int64(tp.tv_sec) * 1000) + (tp.tv_nsec div 1000000);
> end;
>
>
> And I say linux because CLOCK_MONOTONIC is only defined there in fpc,
> though it should be available even in other systems:

CLOCK_MONOTONIC is available only for kernels >= 2.6.26.

zeljko





More information about the Lazarus mailing list