www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - std.date again

reply Carlos Santander <csantander619 gmail.com> writes:
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.


-- 
Carlos Santander Bernal
May 08 2006
next sibling parent Kyle Furlong <kylefurlong gmail.com> writes:
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.
 
 

You might want to use mango.locale. http://dsource.org/projects/mango/browser/trunk/mango/locale?rev=883 -- Kyle Furlong // Physics Undergrad, UCSB "D is going wherever the D community wants it to go." - Walter Bright
May 08 2006
prev sibling next sibling parent Dejan Lekic <dejan nu6.org> writes:
I am getting AssertError when running your example on both Linux and 
Windows:
$ ./std_date_01.exe
UTC  :12:48:08 GMT+0200
Local:14:48:08 GMT+0200
Error: AssertError Failure std_date_01(8)

DMD version:   0.156
compiled with: dmd std_date_01.d
May 09 2006
prev sibling next sibling parent Walter Bright <newshound digitalmars.com> writes:
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?
May 12 2006
prev sibling parent Carlos Santander <csantander619 gmail.com> writes:
Carlos Santander escribió:
 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
 
 

Part of the problem here (I think) is in std/date.d:794, because as I said in digitalmars.D.bugs, UTCtoLocalTime() is added when it shouldn't have, so maybe changing the sign in getLocalTZA() will solve it? -- Carlos Santander Bernal
May 15 2006