[fpc-devel] NowUTC in the RTL

Tomas Hajny XHajT03 at hajny.biz
Fri Dec 9 10:21:03 CET 2011


On Fri, December 9, 2011 09:23, Felipe Monteiro de Carvalho wrote:


Hi,

> I would like to add NowUTC to SysUtils as we have already discussed
> previously. I think that the need for adding this should be of common
> knowledge for all after the long discussions about Now, and I
> understand that this was agreed upon, although surely we can discuss
> again.
>
> So ok, now the problem starts. I have never added a new routine to the
> RTL before, so I am totally lost at what exactly to do, because there
> is a pletora of platforms there and I have implementations only for
> the platforms which I use, which are Windows and UNIX (I think it
> should work in all of them)
>
> So what is done in these cases? Should I give some time for
> maintainers of those platforms to come up with implementations?
>
> And if they don't? Just add a stub returning Now or something like that?

Preferably add a common dummy version (based on Now as you suggested and
possibly environment variable TZ because tools like Zip/Unzip provide this
kind of user controlled support for timezone calculations even for
platforms not providing such functionality at API level) for platforms
without proper support (e.g. GO32v2) and include it under $IFNDEF
HAS_UTCNOW which is then defined at the platform specific implementations.
See sysutils.inc for existing examples.


> Adding a GetTickCount routine would also be good. Lazarus has this:
>
> function GetTickCount64: QWord;
>
> But maybe in the RTL it should have a different name to avoid
> conflicts with the Windows unit... but which name?

Is it preferred to return ticks (dependent on various stuff), or something
like GetMsCount (as already existing in unit Dos)?

Tomas





More information about the fpc-devel mailing list