Question

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?

Was it helpful?

Solution

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.

OTHER TIPS

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top