Download Reference Manual
The Developer's Library for D
About Wiki Forums Source Search Contact

Ticket #2029 (new defect)

Opened 13 years ago

Last modified 13 years ago

WallClock.toUtc problem with Daylight Savings Time in Posix

Reported by: rio Assigned to: kris
Priority: major Milestone: 1.0
Component: Tango Version: 0.99.9 Kai
Keywords: Cc:

Description

When I call WallClock.toUtc, I always get a time where the offset is the timezone offset plus one hour for the Daylight Savings Time - even when there should not be Daylight Savings Time!

The Problem is WallClock.fromDate, where the function mktime is called. According to the specification, mktime checks the value of tm_isdst, which is not set in WallClock.fromDate.

Adding the statement

t.tm_isdst = -1;

will "cause mktime() to attempt to determine whether Daylight Savings Time is in effect for the specified time". This fixes the problem.

Change History

04/12/11 02:38:28 changed by mwarning

thanks for reporting. @kris: thoughts?

04/13/11 18:18:27 changed by kris

yes, thanks rio

toDate(Time) would need to have similar behaviour ... does localtime_r() take a similar flag, or does it just do the "right thing"?