digitalmars.D.bugs - Can't get local time on Windows 2000
- k2 (13/13) Aug 24 2005 import std.date;
- Walter (5/18) Aug 26 2005 Running on my PC, with XP, it gives:
- Carlos Santander (8/35) Aug 26 2005 Walter, this issue has been mentioned before. Check for instance:
- Walter (5/10) Aug 27 2005 Lima,
- Carlos Santander (8/27) Aug 28 2005 On Windows, the problem is in getLocalTZA(). It's returning 0 here, so
- Carlos Santander (7/39) Aug 30 2005 Another thought (even if I haven't tested): if the problem is
- Carlos Santander (7/26) Aug 28 2005 Ok, as I hinted in another post, the problem on linux is easy: getUTCtim...
- Carlos Santander (4/23) Aug 28 2005 Regarding gdc, the problem seems to be in _d_gnu_cbridge_tza(), but I'm ...
- Manfred Nowak (7/8) Aug 26 2005 [...]
- Carlos Santander (29/58) Aug 28 2005 Here're some results:
import std.date; import std.stdio; void main() { writefln("UTC :%s", toTimeString(getUTCtime())); writefln("Local:%s", toTimeString(UTCtoLocalTime(getUTCtime()))); } --- UTC :17:07:24 GMT+0000 Local:17:07:24 GMT+0000 Date of my PC is GMT+09:00. When you test this code, you have to use Windows 2000 or XP, not 9x. And change to time zone that is no daylight-saving.
Aug 24 2005
"k2" <k2_member pathlink.com> wrote in message news:dei96c$94k$1 digitaldaemon.com...import std.date; import std.stdio; void main() { writefln("UTC :%s", toTimeString(getUTCtime())); writefln("Local:%s", toTimeString(UTCtoLocalTime(getUTCtime()))); } --- UTC :17:07:24 GMT+0000 Local:17:07:24 GMT+0000 Date of my PC is GMT+09:00. When you test this code, you have to use Windows 2000 or XP, not 9x. And change to time zone that is no daylight-saving.Running on my PC, with XP, it gives: UTC :10:56:04 GMT-0700 Local:03:56:04 GMT-0700
Aug 26 2005
Walter escribió:"k2" <k2_member pathlink.com> wrote in message news:dei96c$94k$1 digitaldaemon.com...Walter, this issue has been mentioned before. Check for instance: http://www.digitalmars.com/d/archives/digitalmars/D/bugs/189.html http://www.digitalmars.com/d/archives/25669.html I tried k2's code on W2K and it was wrong too. My TZ is GMT-0500, Bogotá, Lima, Quito. -- Carlos Santander Bernalimport std.date; import std.stdio; void main() { writefln("UTC :%s", toTimeString(getUTCtime())); writefln("Local:%s", toTimeString(UTCtoLocalTime(getUTCtime()))); } --- UTC :17:07:24 GMT+0000 Local:17:07:24 GMT+0000 Date of my PC is GMT+09:00. When you test this code, you have to use Windows 2000 or XP, not 9x. And change to time zone that is no daylight-saving.Running on my PC, with XP, it gives: UTC :10:56:04 GMT-0700 Local:03:56:04 GMT-0700
Aug 26 2005
"Carlos Santander" <csantander619 gmail.com> wrote in message news:deo9l4$25i2$1 digitaldaemon.com...Walter, this issue has been mentioned before. Check for instance: http://www.digitalmars.com/d/archives/digitalmars/D/bugs/189.html http://www.digitalmars.com/d/archives/25669.html I tried k2's code on W2K and it was wrong too. My TZ is GMT-0500, Bogotá,Lima,Quito.It doesn't happen on my system. Can you perhaps take a look at std.date.d and debug it on your system? It's only a few lines of code.
Aug 27 2005
Walter escribió:"Carlos Santander" <csantander619 gmail.com> wrote in message news:deo9l4$25i2$1 digitaldaemon.com...On Windows, the problem is in getLocalTZA(). It's returning 0 here, so UTCtoLocalTime() fails because it does nothing to the date returned by getUTCtime(). I don't know how GetTimeZoneInformation() should work, but I'd guess the problem is in that switch in getLocalTZA(). I still have to check on linux. -- Carlos Santander BernalWalter, this issue has been mentioned before. Check for instance: http://www.digitalmars.com/d/archives/digitalmars/D/bugs/189.html http://www.digitalmars.com/d/archives/25669.html I tried k2's code on W2K and it was wrong too. My TZ is GMT-0500, Bogotá,Lima,Quito.It doesn't happen on my system. Can you perhaps take a look at std.date.d and debug it on your system? It's only a few lines of code.
Aug 28 2005
Carlos Santander escribió:Walter escribió:Another thought (even if I haven't tested): if the problem is GetTimeZoneInformation(), why not replace the code when it returns 0 with a call to GetSystemTime() and GetLocalTime(), and then get the timezone from that difference? -- Carlos Santander Bernal"Carlos Santander" <csantander619 gmail.com> wrote in message news:deo9l4$25i2$1 digitaldaemon.com...On Windows, the problem is in getLocalTZA(). It's returning 0 here, so UTCtoLocalTime() fails because it does nothing to the date returned by getUTCtime(). I don't know how GetTimeZoneInformation() should work, but I'd guess the problem is in that switch in getLocalTZA(). I still have to check on linux.Walter, this issue has been mentioned before. Check for instance: http://www.digitalmars.com/d/archives/digitalmars/D/bugs/189.html http://www.digitalmars.com/d/archives/25669.html I tried k2's code on W2K and it was wrong too. My TZ is GMT-0500, Bogotá,Lima,Quito.It doesn't happen on my system. Can you perhaps take a look at std.date.d and debug it on your system? It's only a few lines of code.
Aug 30 2005
Walter escribió:"Carlos Santander" <csantander619 gmail.com> wrote in message news:deo9l4$25i2$1 digitaldaemon.com...Ok, as I hinted in another post, the problem on linux is easy: getUTCtime() is returning the local time, which means gettimeofday() or time() return the local time. Maybe there should be getUTCtime() and getLocalTime() in phobos: on linux, getUTCtime() calls getLocalTime() and on Windows it's the opposite. Just an idea... -- Carlos Santander BernalWalter, this issue has been mentioned before. Check for instance: http://www.digitalmars.com/d/archives/digitalmars/D/bugs/189.html http://www.digitalmars.com/d/archives/25669.html I tried k2's code on W2K and it was wrong too. My TZ is GMT-0500, Bogotá,Lima,Quito.It doesn't happen on my system. Can you perhaps take a look at std.date.d and debug it on your system? It's only a few lines of code.
Aug 28 2005
Walter escribió:"Carlos Santander" <csantander619 gmail.com> wrote in message news:deo9l4$25i2$1 digitaldaemon.com...Regarding gdc, the problem seems to be in _d_gnu_cbridge_tza(), but I'm not sure. -- Carlos Santander BernalWalter, this issue has been mentioned before. Check for instance: http://www.digitalmars.com/d/archives/digitalmars/D/bugs/189.html http://www.digitalmars.com/d/archives/25669.html I tried k2's code on W2K and it was wrong too. My TZ is GMT-0500, Bogotá,Lima,Quito.It doesn't happen on my system. Can you perhaps take a look at std.date.d and debug it on your system? It's only a few lines of code.
Aug 28 2005
Walter wrote in news:denlng$1mrb$1 digitaldaemon.comRunning on my PC, with XP[...] Running XP also: GMT is true localtime localtime is true localtime +0200 Switching the timezones confirms the behaviour described. -manfred
Aug 26 2005
Walter escribió:"k2" <k2_member pathlink.com> wrote in message news:dei96c$94k$1 digitaldaemon.com...Here're some results: ---gdc 0.15 on Mac--- $ date Sun Aug 28 15:27:26 ECT 2005 $ ./test UTC :01:27:28 GMT+0500 Local:06:27:28 GMT+0500 ---gdc 0.15 on Linux--- $ date dom ago 28 15:27:10 ECT 2005 $ ./test UTC :01:27:15 GMT+0500 Local:06:27:15 GMT+0500 ---dmd 0.128 on Linux--- $ ./test UTC :15:27:13 GMT-0500 Local:10:27:13 GMT-0500 ---dmd 0.128 on WinXP---import std.date; import std.stdio; void main() { writefln("UTC :%s", toTimeString(getUTCtime())); writefln("Local:%s", toTimeString(UTCtoLocalTime(getUTCtime()))); } --- UTC :17:07:24 GMT+0000 Local:17:07:24 GMT+0000 Date of my PC is GMT+09:00. When you test this code, you have to use Windows 2000 or XP, not 9x. And change to time zone that is no daylight-saving.Running on my PC, with XP, it gives: UTC :10:56:04 GMT-0700 Local:03:56:04 GMT-0700timeLa hora actual es: 15:36:32,94 Escriba una nueva hora:testUTC :20:36:34 GMT+0000 Local:20:36:34 GMT+0000 So, gdc is as lost as it can be. DMD on linux, getUTCtime() returns the local time. DMD on Windows, getUTCtime() is correct. UTCtoLocalTime() on linux seems to be ok, but not on Windows. Remember, my TZ is GMT-0500, no CT, no ET, but South America. -- Carlos Santander Bernal
Aug 28 2005