3 ms·
I once had to spend an entire evening finding the root cause of a bug in a time parsing code I used to work on that would show up only when DST is in effect. Th
by susam 10y ago
I once had to spend an entire evening finding the root cause of a bug in a time parsing code I used to work on that would show up only when DST is in effect. The bug was due to the way mktime() function used the value of tm_isdst member variable of struct tm. If DST was in effect and t->tm_isdst = 0, then mktime(t) would add an hour to t and set t->tm_isdst = 1. If DST was not in effect and t->tm_isdst = 1, then mktime(t) would subtract an hour from t and set t->tm_isdst = 0. See http://stackoverflow.com/q/9041514/303363 http://stackoverflow.com/q/9041514/303363 for more details.