[fpc-devel] NowUTC in the RTL
Michael Van Canneyt
michael at freepascal.org
Fri Dec 9 13:47:08 CET 2011
On Fri, 9 Dec 2011, Tomas Hajny wrote:
> On Fri, December 9, 2011 13:07, Jonas Maebe wrote:
>> On 09 Dec 2011, at 12:28, Michael Van Canneyt wrote:
>>> The linux kernel returns UTC time, it always has. Now() converts
>>> this to local time.
>>> (as does libc). All NowUTC needs to do is return the kernel time.
>> It should only be called NowUTC if it is defined as always returning
>> UTC on all platforms.
> Obviously assuming that something like that is possible on a certain
> platform at all (GO32v2 not having the TZ environment variable defined
> will simply never be able to provide UTC time; in fact, the same applies
> for OS/2 / eCS too).
I do not think the Go32V2 environment needs to be considered.
It stems from an age where the difference in timezones was irrelevant on a PC.
There are much more functions that perform strangely - if at all - in go32V2.
It doesn't even have threading multi-tasking or multi-user support.
Nonetheless we introduced already lots of functions that assume this,
and no-one so much as squeaked then.
For a function as NowUTC I do not think we should start pulling this argument.
As far as I know, Windows and all Unix-like OSes support returning UTC.
I know nothing about OS/2-eCS, but the same arguments as for Go32V2 apply
as far as I am concerned. If all these platforms can guarantee returning
correct UTC time, I do not see why we would not introduce it.
More information about the fpc-devel