Article Review: Migrating from std.date to std.datetime
Rainer Schuetze
r.sagitario at gmx.de
Mon May 16 15:00:24 PDT 2011
Jonathan M Davis wrote:
> On 2011-05-15 03:34, Rainer Schuetze wrote:
>> - my current uses of datetime are comparing file times and displaying
>> the file time. Much better than std.date, the times displayed are now
>> the same as shown by Explorer/dir most of the time, but some are off by
>> one hour. It seems this happens for times with a different daylight
>> saving. Is this a bug? Or do I need to call something else than
>>
>> writeln(timeLastModified(file).toSimpleString());
>>
>> The ISO versions or conversion to DateTime produce the same output. My
>> local time is UTC+1+DST.
>
> I'd need more data to have any idea what's going on, but it sounds like a bug.
I have investigated it a bit, and I'm currently thinking that Explorer,
dir and Total Commander are wrong, and std.datetime is right.
What I did to test:
- create a new file, verify the dates printed are correct. fine in all
programs
- set the system time back to February
- create the file again, verify the dates printed are correct. fine in
all programs
- set the system time back to May
- now the displayed file time is the same when using std.datetime, but
an hour later with all other programs.
Maybe it's an XP or NTFS issue, but I would expect the file time not to
change with the date it is displayed.
More information about the Digitalmars-d
mailing list