Seems like a bug, have a look at the code first:
#include <time.h>
#include <stdio.h>
int main() {
time_t t;
struct tm tm1;
tzset();
time(&t);
localtime_r(&t, &tm1);
tm1.tm_mday = 27;
tm1.tm_sec = 59;
tm1.tm_min = 59;
tm1.tm_hour = 0;
tm1.tm_mon = 9;
t = mktime(&tm1);
printf(" tm_hour = %d:\t\t(%d) %s", tm1.tm_hour, t, asctime(&tm1));
tm1.tm_mday = 26;
tm1.tm_sec = 59;
tm1.tm_min = 59;
tm1.tm_hour = 0;
tm1.tm_mon = 9;
t = mktime(&tm1);
printf(" tm_hour = %d:\t\t(%d) %s", tm1.tm_hour, t, asctime(&tm1));
}
I believe it shall run like this:
$ ./tzcheck3 tm_hour = 0: (1414360799) Mon Oct 27 00:59:59 2014 tm_hour = 0: (1414270799) Sun Oct 26 00:59:59 2014
Instead I've got this:
$ ./tzcheck3 tm_hour = 0: (1414360799) Mon Oct 27 00:59:59 2014 tm_hour = 1: (1414274399) Sun Oct 26 01:59:59 2014
OS installed is Solaris 11.2.2.8.0 + IDR 1418.1, timezone data is 2014f, here is timezone zdump:
# zdump -v Europe/Moscow | tail -10 Europe/Moscow Sat Mar 27 22:59:59 2010 UTC = Sun Mar 28 01:59:59 2010 MSK isdst=0 Europe/Moscow Sat Mar 27 23:00:00 2010 UTC = Sun Mar 28 03:00:00 2010 MSD isdst=1 Europe/Moscow Sat Oct 30 22:59:59 2010 UTC = Sun Oct 31 02:59:59 2010 MSD isdst=1 Europe/Moscow Sat Oct 30 23:00:00 2010 UTC = Sun Oct 31 02:00:00 2010 MSK isdst=0 Europe/Moscow Sat Mar 26 22:59:59 2011 UTC = Sun Mar 27 01:59:59 2011 MSK isdst=0 Europe/Moscow Sat Mar 26 23:00:00 2011 UTC = Sun Mar 27 03:00:00 2011 MSK isdst=0 Europe/Moscow Sat Oct 25 21:59:59 2014 UTC = Sun Oct 26 01:59:59 2014 MSK isdst=0 Europe/Moscow Sat Oct 25 22:00:00 2014 UTC = Sun Oct 26 01:00:00 2014 MSK isdst=0 Europe/Moscow Tue Jan 19 03:14:07 2038 UTC = Tue Jan 19 06:14:07 2038 MSK isdst=0 Europe/Moscow Mon Jan 18 03:14:07 2038 UTC = Mon Jan 18 06:14:07 2038 MSK isdst=0
You can see that there is a switchover at Sun Oct 26 02:00, but I still cannot understand why mktime makes 01:59 from 00:59 at this date.
What do you think?