[fpc-pascal] The unfortunate deprecation of GetTickCount

Paulo Costa paco.mail.telepac.pt at gmail.com
Wed Apr 11 15:40:39 CEST 2018


Unfortunate is the obscure wording you find on the documentation:

https://www.freepascal.org/docs-html/rtl/sysutils/gettickcount.html

"Description
GetTickCount returns an increasing clock tick count. It is useful for 
time measurements, but no assumtions should be made as to the interval 
between the ticks. This function is provided for Delphi compatibility, 
use GetTickCount64 instead."

One would think that GetTickCount64 would clarify things about the 
interval between the ticks (just to be useful for time measurements) but:
https://www.freepascal.org/docs-html/rtl/sysutils/gettickcount64.html

"Description
GetTickCount64 returns an increasing clock tick count. It is useful for 
time measurements, but no assumtions should be made as to the interval 
between the ticks."

How can it be useful for time measurements if we don't know the units?

Contrast to the Microsoft Documentation:
https://msdn.microsoft.com/en-us/library/windows/desktop/ms724408(v=vs.85).aspx

"Return value
The return value is the number of milliseconds that have elapsed since 
the system was started."

Of course, it is followed by some remarks about the real limitations but 
at least we have some idea on what to expect.

I know that, by being cross platform, GetTickCount64 can behave in 
different ways on other environments but, just because of that, the user 
should not be kept in the dark when using it.

I know that the documentation effort is hard and many times we don't 
appreciate the effort as we should, but please don't be so vague on this 
entry.

Paulo Costa



More information about the fpc-pascal mailing list