[Issue 12828] New: Fix SimpleTimeZone.utcOffset so that it has the correct return type

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Sat May 31 13:13:49 PDT 2014


https://issues.dlang.org/show_bug.cgi?id=12828

          Issue ID: 12828
           Summary: Fix SimpleTimeZone.utcOffset so that it has the
                    correct return type
           Product: D
           Version: unspecified
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: Phobos
          Assignee: nobody at puremagic.com
          Reporter: jmdavisProg at gmx.com

It's the policy of time-related code in druntime and Phobos to never use naked
integral values for time - in particular, any duration of time should use
core.time.Duration rather than an integer for seconds or microseconds or
whatnot.

I got this right almost everywhere in core.time and std.datetime, but for some
reason I screwed up when writing SimpleTimeZone and didn't catch it before it
got merged into Phobos. SimpleTimeZone.utcOffset is supposed to return the
offset from UTC for that time zone, and should return a Duration.
Unfortunately, it returns an int which represents minutes (something which is
done with the POSIX functions in glibc and whatnot). So, utcOffset needs to be
changed to be a Duration.

--


More information about the Digitalmars-d-bugs mailing list