In my application, I need to calculate the shifts using the template described in the file. Recently, one of my clients had an application freeze for the following reason:
If you fill in "struct tm" with the exact moment at the end of winter (non-DST), _mktime seems to return the wrong result.
The code is as follows:
struct tm tm_start;
tm_start.tm_mday = startday;
tm_start.tm_mon = startmonth-1;
tm_start.tm_year = startyear-1900;
tm_start.tm_hour = starthour;
tm_start.tm_min = startmin;
tm_start.tm_sec = startsec;
tm_start.tm_isdst = -1;
_int64 contTime = _mktime64(&tm_start);
Suppose that from April 5 at 2:00 there is a transition from winter to summer time. In practice, this means that we have the following points in time:
5 April, 1:58
5 April, 1:59
5 April, 3:00
Since I don’t know in the application when the DST starts or ends (do I really want to know this?) I pass the date "April 5, 2:00" to _mktime64 using the code shown above.
, _mktime64 time_t, 5 , 3:00 ( , 5 , 2:00).
, . _mktime64 tm_start 5 , 1:00 time_t. , .
(: 2:00 3:00 _mktime64, 1:00 2:00)
, Visual Studio 2005, , , Visual Studio 2010 (Release Candidate) .
XP, Windows7 ( Vista).
?
?