Bug 5731 – std.datetime.SysTime prints UTC offsets backwards
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2011-03-12T00:29:00Z
Last change time
2015-06-09T05:14:45Z
Assigned to
nobody
Creator
issues.dlang
Comments
Comment #0 by issues.dlang — 2011-03-12T00:29:11Z
This program:
import std.datetime;
import std.stdio;
void main()
{
writeln(SysTime(Date.init, WindowsTimeZone.getTimeZone("Pacific Standard Time")));
writeln(SysTime(Date.init, WindowsTimeZone.getTimeZone("Eastern Standard Time")));
writeln(SysTime(Date.init, WindowsTimeZone.getTimeZone("Greenwich Standard Time")));
writeln(SysTime(Date.init, WindowsTimeZone.getTimeZone("Romance Standard Time")));
}
prints this:
0001-Jan-01 00:00:00+08:00
0001-Jan-01 00:00:00+05:00
0001-Jan-01 00:00:00+00:00
0001-Jan-01 00:00:00-01:00
Notice that the offsets are all the reverse of what they're supposed to be (+8 instead of -8, +5 instead of -5, etc.).
Comment #1 by issues.dlang — 2011-03-12T03:47:36Z
Okay. So, this isn't a WindowsTimeZone problem. It's a problem with SysTime's string functions (toISOExtendedString in the example, but it's the same for all of them) where they get the UTC offset backwards.