[fpc-devel] NowUTC in the RTL

Michael Van Canneyt michael at freepascal.org
Fri Dec 9 13:38:18 CET 2011



On Fri, 9 Dec 2011, Felipe Monteiro de Carvalho wrote:

> 2011/12/9 Tomas Hajny <XHajT03 at hajny.biz>:
>> Is it preferred to return ticks (dependent on various stuff), or something
>> like GetMsCount (as already existing in unit Dos)?
>
> I would like to define it like this:
>
> "FPGetTickCount returns the amount of ticks since an unspecified
> initial time. This initial time is unknown, but is fixed for the
> entire duration of the application. Ticks are time intervals and all
> of them have the same duration, but their exact meaning in terms of
> real world units like milliseconds is unspecified. FPGetTickCount is
> not affected by timezones and also not by the user changing the system
> clock."
>
> So it matches Windows.GetTickCount well but still is flexible enough
> to be implemented in other platforms.
>
>> I don't think it needs a different name, GetTickCount is OK. Why would you need that ? Units are namespaces, after all.
>
> Yes, but legacy applications with both SysUtils and Windows in the
> uses clause might suddently start using the SysUtils routine ... In
> Lazarus we tried something like that and we got a couple of problems
> very fast by units which suddenly started using the new GetTickCount
> ... it had to do with our GetTickCount returning 64-bits and the
> Windows one returning 32-bits... so that's why I would recommend
> FPGetTickCount: QWord

OK.

Michael.



More information about the fpc-devel mailing list