std.datetime questions

Nicholas maybe at later.com
Fri Mar 11 12:29:49 PST 2011


I just started using the new std.datetime.  Two things I find strange that
maybe someone can explain are:


1) EST timezone displays GMT+0500 instead of -0500 when using any of the
toString functions.  Didn't check other negative timezones.


2) The UTC time for std.file's DirEntry uses milliseconds, so when converting
SysTime to UTC, I had to use toUnixTime and then I had to multiple the result
by 1000.


Also, I found it strange that this wouldn't work:

auto stime = SysTime( ... );
long timetest = stime.toUnixTime() * 1000; //doesn't work

I had to do:

timetest = stime.toUnixTime();
timetest *= 1000;


I believe there's also a problem with the time in SysTime when you specify a
timezone and set the time to 0 in the constructor, e.g. SysTime( DateTime(
2011, 3, 11 ), TimeZone( "America/New_York" ) ), in that it forces the time to
GMT instead of the specified local time.  I'll have to double check but I know
it worked when I used a non-zero time.


More information about the Digitalmars-d mailing list