[Lazarus] Better implementation of GetTickcount using clock_gettime

Mattias Gaertner nc-gaertnma at netcologne.de
Wed Apr 2 14:28:54 CEST 2014


On Wed, 02 Apr 2014 14:01:26 +0200
zeljko <zeljko at holobit.net> wrote:

>[...]
> My guess is that there no need to speculate what most programs need but 
> what is more precise or better to say what is correct.

They measure different things. The precision depends on what you
expect.


> IMO CLOCK_MONOTONIC is affected by eg. ntp/adjtime() so result of 
> GetTickCount() is not correct in all cases.
> Imagine daemon service which relies on GetTickCount and then clock 
> change due to the daylight via

Sigh. Again: CLOCK_MONOTONIC is monotonic. It does not go
backwards and especially it does not apply timezone, daylight or user
time changes. It only fixes shortcomings of the machine counters.

See for example here:
http://man7.org/linux/man-pages/man2/clock_gettime.2.html

Mattias




More information about the Lazarus mailing list