C ++ time difference function calculates daylight saving time?

If I use the C ++ timediff function to smooth out the difference between 2 times and a later time, after changing the time to save daylight, the size difference is obtained.

eg. I have a time of 23:00 and a time of 11:00. Time changes in the middle of this time, that is, it goes forward by one hour.

Will I get 12 hours or 11 differences?

+3


source to share


2 answers


Function difftime

, not timediff

. And it takes two time_t

as arguments; time_t

usually represent UTC, not specific local time, so daylight savings time does not occur.



+1


source


Yes. I had to deal with him as far back as visual studio 6 in the Y2k days. Then they changed the DST rules that were not valid for the code.



If you see a mysterious jump an hour forward and an hour back, DST brings up its ugly head in RTL.

0


source







All Articles