Timezone database file format question
'Standard time' refers to 'winter time' as opposed to 'summer time' or 'daylight saving time'. Yes, GMT (loosely; strictly, UTC) is 'the standard for time', but it is not quite the same as what is being referred to by the 'isstd' column in your data.
The point about 'isstd' being 0 or 1 is that the transition times in Europe are (normally) specified to take place at 02:00 in the current time zone.
Thus, the clocks for Europe/Rome went:
1982-03-28 01:59:59 (UTC+01:00)1982-03-28 03:00:00 (UTC+02:00)
This transition was documented to occur at 02:00 standard time (so isstd = 1
), but this was not a UTC (GMT) time; hence it was a Type 0 transition in your list. Conversely, in the autumn, the clocks went:
1982-09-26 01:59:59 (UTC+02:00)1982-09-26 01:00:00 (UTC+01:00)
The transition was documented to occur at 02:00 in time zone prevailing prior to the switch, so isstd = 0
(but it was not a UTC (GMT) time); hence, it was a Type 3 transition in your list.
The other combinations (types 1, 2, 4, 5) appear in other circumstances. For the same two transitions, you'd use a type 4 entry and document the change time as 01:00 UTC (because 01:00:00+00:00 is the same as 02:00:00+01:00; and you'd use a type 5 entry and document the change time as 00:00 UTC (because 00:00:00+00:00 is the same as 02:00:00+02:00). Note that the switch times here are different from each other. Analogous differences in the description apply to types 1 and 2.
I was going to edit my original post, but it says that it is too long:
Update:
I am thinking that my data is correct, and TimeAndDate.com has a minor bug.
For my tests, I focused on the first 2 transitions for Rome.
My data was:
type: 0, transition time in file:-1690851600
Add previous offset to get local transition time: June 03, 1916 00:00:00 New timezone is GMT+2
type: 1, transition time in file:-1680483600
Add previous offset to get local transition time: October 01, 1916 01:00:00 New timezone is GMT+1
TimeAndDate's data shows:
1.) Saturday, June 3, 1916 11:59:59 PM
Sunday, June 4, 1916 12:00:00 Midnight → 1:00:00 AM +1h UTC+2h CEST DST starts
2.) Saturday, September 30, 1916 11:59:59 PM
12:00:00 Midnight → 11:00:00 PM No UTC+1h CET DST ends
I set my computer's timezone and local time to match Rome.Then, I ran the following code:
time_t rome_ts;struct tm * rome_info;char rome_buffer[75];printf("My first transition:\n");rome_ts = -1690851601;rome_info = localtime(&rome_ts);printf("Timestamp: %ld\n",rome_ts);strftime(rome_buffer,75,"%A %B %d, %Y %H:%M:%S %Z",rome_info);printf("%s, dst? = %d\n",rome_buffer,rome_info->tm_isdst);printf("\n");rome_ts = -1690851600;rome_info = localtime(&rome_ts);printf("Timestamp: %ld\n",rome_ts);strftime(rome_buffer,75,"%A %B %d, %Y %H:%M:%S %Z",rome_info);printf("%s, dst? = %d\n",rome_buffer,rome_info->tm_isdst);printf("\n");rome_ts = -1690851599;rome_info = localtime(&rome_ts);printf("Timestamp: %ld\n",rome_ts);strftime(rome_buffer,75,"%A %B %d, %Y %H:%M:%S %Z",rome_info);printf("%s, dst? = %d\n",rome_buffer,rome_info->tm_isdst);printf("\n\n\n");printf("TimeandDate.com's first transition:\n");rome_ts = -1690768801;rome_info = localtime(&rome_ts);printf("Timestamp: %ld\n",rome_ts);strftime(rome_buffer,75,"%A %B %d, %Y %H:%M:%S %Z",rome_info);printf("%s, dst? = %d\n",rome_buffer,rome_info->tm_isdst);printf("\n");rome_ts = -1690768800;rome_info = localtime(&rome_ts);printf("Timestamp: %ld\n",rome_ts);strftime(rome_buffer,75,"%A %B %d, %Y %H:%M:%S %Z",rome_info);printf("%s, dst? = %d\n",rome_buffer,rome_info->tm_isdst);printf("\n");rome_ts = -1690768799;rome_info = localtime(&rome_ts);printf("Timestamp: %ld\n",rome_ts);strftime(rome_buffer,75,"%A %B %d, %Y %H:%M:%S %Z",rome_info);printf("%s, dst? = %d\n",rome_buffer,rome_info->tm_isdst);printf("\n\n\n");printf("My second transition:\n");rome_ts = -1680483601;rome_info = localtime(&rome_ts);printf("Timestamp: %ld\n",rome_ts);strftime(rome_buffer,75,"%A %B %d, %Y %H:%M:%S %Z",rome_info);printf("%s, dst? = %d\n",rome_buffer,rome_info->tm_isdst);printf("\n");rome_ts = -1680483600;rome_info = localtime(&rome_ts);printf("Timestamp: %ld\n",rome_ts);strftime(rome_buffer,75,"%A %B %d, %Y %H:%M:%S %Z",rome_info);printf("%s, dst? = %d\n",rome_buffer,rome_info->tm_isdst);printf("\n");rome_ts = -1680483599;rome_info = localtime(&rome_ts);printf("Timestamp: %ld\n",rome_ts);strftime(rome_buffer,75,"%A %B %d, %Y %H:%M:%S %Z",rome_info);printf("%s, dst? = %d\n",rome_buffer,rome_info->tm_isdst);printf("\n\n\n");
The output showed that localtime() agreed with my transition times:
My first transition: Timestamp:
-1690851601 Friday June 02, 1916 23:59:59 CET, dst? = 0
Timestamp: -1690851600 Saturday June 03, 1916 01:00:00 CEST, dst? = 1
Timestamp: -1690851599 Saturday June 03, 1916 01:00:01 CEST, dst? = 1
TimeandDate.com's first transition:
Timestamp: -1690768801 Saturday June 03, 1916 23:59:59 CEST, dst? = 1
Timestamp: -1690768800 Sunday June 04, 1916 00:00:00 CEST, dst? = 1
Timestamp: -1690768799 Sunday June 04, 1916 00:00:01 CEST, dst? = 1
My second transition: Timestamp:
-1680483601 Sunday October 01, 1916 00:59:59 CEST, dst? = 1
Timestamp: -1680483600 Sunday October 01, 1916 00:00:00 CET, dst? = 0
Timestamp: -1680483599 Sunday October 01, 1916 00:00:01 CET, dst? = 0