Bug 4096 – nonzero timezone offset in UTC timestamp; wrong local time.

Status
RESOLVED
Resolution
WONTFIX
Severity
normal
Priority
P2
Component
phobos
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2010-04-16T06:16:00Z
Last change time
2011-02-03T01:29:06Z
Assigned to
nobody
Creator
graham.fawcett

Comments

Comment #0 by graham.fawcett — 2010-04-16T06:16:57Z
In DMD Version 2.043, the following code should print a timestamp both in UTC and local time. The local tzoffset is correct, but the UTC tzoffset should not be nonzero. Furthermore, what claims to be the UTC time is actually the localtime, and the so-called localtime is just wrong. The code imports std.datebase to hack around the initialization issue reported in #2965. #!/usr/bin/dmd -run import std.datebase; import std.stdio; import std.date; void main() { writefln("UTC: %s", toString(getUTCtime())); writefln("Local: %s", toString(UTCtoLocalTime(getUTCtime()))); } $ TZ=EST5EDT date Fri Apr 16 09:14:35 EDT 2010 $ TZ=EST5EDT ./timedemo.d UTC: Fri Apr 16 09:14:37 GMT-0400 2010 Local: Fri Apr 16 05:14:37 GMT-0400 2010
Comment #1 by bugzilla — 2011-02-03T01:29:06Z
std.date has been superseded by std.datetime.