Reputation: 33
If I use the C++ time difference (timediff) function to caculate a the difference between 2 times and the later time is after the time change for day light savings will the returned difference caculate this.
E.g. I have a time of 23:00 and a time of 11:00. The time changes in the middle of this time i.e it goes forward one hour.
Will I get 12 hours or 11 difference?
Upvotes: 3
Views: 1381
Reputation: 28872
Yes you will. I had to deal with it back in visual studio 6 back in the Y2k days. Then they changed the DST rules invalidating the code.
If you see a mysterious jump of an hour forward, and an hour back it is DST rearing its ugly head in the RTL.
Upvotes: 0
Reputation: 153977
The function is difftime
, not timediff
. And it takes two
time_t
as arguments; time_t
typically represent UTC, not
a particular local time, so the summer time issue doesn't occur.
Upvotes: 1