std.date again

Jari-Matti Mäkelä jmjmak at utu.fi.invalid
Fri May 12 13:33:31 PDT 2006


Carlos Santander wrote:
> Walter Bright escribió:
>> Carlos Santander wrote:
>>> Here it's again:
>>>
>>> //------------------------
>>> import std.date;
>>> import std.stdio;
>>>
>>> void main()
>>> {
>>> writefln("UTC  :%s", toTimeString(getUTCtime()));
>>> writefln("Local:%s", toTimeString(UTCtoLocalTime(getUTCtime())));
>>> }
>>> //------------------------
>>>
>>> :::: gdc 0.17, Mac OS X 10.4.6
>>>
>>> $ ./test
>>> UTC  :06:20:52 GMT+0500
>>> Local:11:20:52 GMT+0500
>>>
>>> $ date
>>> Mon May  8 20:21:01 ECT 2006
>>>
>>>
>>> :::: DMD 0.155, Windows XP SP 2
>>>
>>> D:\>test
>>> UTC  :01:27:19 GMT+0000
>>> Local:01:27:19 GMT+0000
>>>
>>> D:\>time
>>> La hora actual es: 20:27:32,08
>>>
>>>
>>> :::: DMD 0.155, Mandrake Linux 10.1
>>>
>>> $ ./test
>>> UTC  :20:34:23 GMT-0500
>>> Local:15:34:23 GMT-0500
>>>
>>> $ date
>>> lun may  8 20:34:27 ECT 2006
>>>
>>>
>>> Walter, at least take a look at UTC on Linux: that's the correct
>>> local time, which most certainly gives a clue of where the solution
>>> might be.
>>>
>>> In all my systems, the timezone is GMT -0500 aka Bogotá, Lima, Quito,
>>> aka ECT.
>>
>> So you're saying the linux results are correct?
> 
> No, I'm saying the UTC result on linux is the correct local result.
> 

It's GMT + 2 + Daylight saving Time here now:

$ ./test
UTC  :23:27:47 GMT+0300
Local:02:27:47 GMT+0300
$ date
pe 12.5.2006 23:27:58 +0300

The date values have been this way (=wrong) as long as I remember. 'UTC'
in D is the current local time and 'Local' is UTC + 2 * (Local - UTC).

-- 
Jari-Matti



More information about the Digitalmars-d-bugs mailing list