[Lazarus] Better implementation of GetTickcount using clock_gettime
Henry Vermaak
henry.vermaak at gmail.com
Tue Apr 1 13:57:12 CEST 2014
On Tue, Apr 01, 2014 at 12:45:54PM +0200, zeljko wrote:
> 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.
No, it's been around since before 2.6.
Henry
More information about the Lazarus
mailing list