[Issue 4096] New: nonzero timezone offset in UTC timestamp; wrong local time.

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Apr 16 06:17:01 PDT 2010


http://d.puremagic.com/issues/show_bug.cgi?id=4096

           Summary: nonzero timezone offset in UTC timestamp; wrong local
                    time.
           Product: D
           Version: future
          Platform: x86_64
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: graham.fawcett at gmail.com


--- Comment #0 from Graham Fawcett <graham.fawcett at gmail.com> 2010-04-16 06:16:57 PDT ---
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

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list