[tz] zdump bug in Asia/Singapore

Tim Parenti tim at timtimeonline.com
Sat Sep 6 22:54:44 UTC 2014


While sorting out some issues for tzdist, I noticed a bug in zdump, 
which is still present in 2014g.

Running zdump on Asia/Singapore for both 1981 and 1982 together produces 
the expected transition from UTC+7:30 to UTC+8 at the boundary between 
those years:

$ ./zdump.exe -vc 1981,1983 Asia/Singapore
Asia/Singapore  -9223372036854775808 = NULL
Asia/Singapore  -9223372036854689408 = NULL
Asia/Singapore  Thu Dec 31 16:29:59 1981 UT = Thu Dec 31 23:59:59 1981 
SGT isdst=0
Asia/Singapore  Thu Dec 31 16:30:00 1981 UT = Fri Jan  1 00:30:00 1982 
SGT isdst=0
Asia/Singapore  9223372036854689407 = NULL
Asia/Singapore  9223372036854775807 = NULL

However, running it on 1981 and 1982 individually does not:

$ ./zdump.exe -vc 1981,1982 Asia/Singapore
Asia/Singapore  -9223372036854775808 = NULL
Asia/Singapore  -9223372036854689408 = NULL
Asia/Singapore  9223372036854689407 = NULL
Asia/Singapore  9223372036854775807 = NULL

$ ./zdump.exe -vc 1982,1983 Asia/Singapore
Asia/Singapore  -9223372036854775808 = NULL
Asia/Singapore  -9223372036854689408 = NULL
Asia/Singapore  9223372036854689407 = NULL
Asia/Singapore  9223372036854775807 = NULL

Initially, I thought this might have to do with the fact that the 
transition is specified as a Zone continuation line rather than as a 
Rule, since zdump properly handled my extended edge-case examples to Jon 
Skeet a while back:
http://mm.icann.org/pipermail/tz/2014-July/021162.html 
<http://mm.icann.org/pipermail/tz/2014-July/021162.html>

zdump also properly handles Asia/Dhaka's DST transition at the end of 
2009, but fails in some other similar cases.

So it looks like it's more to do with the transition taking place too 
close to the year boundary.  Part of the problem may be the transition 
happening in different years, UTC and local, but that doesn't seem to be 
all that's going on.

Attached are some test cases to run against various versions of 
Singapore with 1981,1982 and 1982,1983; and various versions of Dhaka 
with 2009,2010 and 2010,2011.  All of these should work, but most 
currently don't.  (The ones that do are marked.)

-- 
Tim Parenti

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mm.icann.org/pipermail/tz/attachments/20140906/104752f8/attachment.htm>
-------------- next part --------------
# The real Asia/Singapore zone.
#
# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
Zone	Asia/Singapore	6:55:25 -	LMT	1901 Jan  1
			6:55:25	-	SMT	1905 Jun  1 # Singapore M.T.
			7:00	-	MALT	1933 Jan  1 # Malaya Time
			7:00	0:20	MALST	1936 Jan  1
			7:20	-	MALT	1941 Sep  1
			7:30	-	MALT	1942 Feb 16
			9:00	-	JST	1945 Sep 12
			7:30	-	MALT	1965 Aug  9 # independence
			7:30	-	SGT	1982 Jan  1 # Singapore Time
			8:00	-	SGT


# Some test cases for zdump.
# Each of these should result in a transition in either 1981 or 1982.
# That is, a transition should appear either with
#   zdump -vc 1981,1982 ZONE_NAME
# or with
#   zdump -vc 1982,1983 ZONE_NAME
#
Zone	Test/Singapore/Unspecified	7:30	-	SGT	1982 Jan  1
			8:00	-	SGT

Zone	Test/Singapore/2359utc	7:30	-	SGT	1981 Dec 31 23:59u
			8:00	-	SGT
Zone	Test/Singapore/2400utc	7:30	-	SGT	1981 Dec 31 24:00u
			8:00	-	SGT
Zone	Test/Singapore/0000utc	7:30	-	SGT	1982 Jan  1  0:00u
			8:00	-	SGT
Zone	Test/Singapore/0001utc	7:30	-	SGT	1982 Jan  1  0:01u	# Works
			8:00	-	SGT

Zone	Test/Singapore/2359wall	7:30	-	SGT	1981 Dec 31 23:59
			8:00	-	SGT
Zone	Test/Singapore/2400wall	7:30	-	SGT	1981 Dec 31 24:00
			8:00	-	SGT
Zone	Test/Singapore/0000wall	7:30	-	SGT	1982 Jan  1  0:00
			8:00	-	SGT
Zone	Test/Singapore/0001wall	7:30	-	SGT	1982 Jan  1  0:01
			8:00	-	SGT

Zone	Test/Singapore/2359wall_as_utc	7:30	-	SGT	1981 Dec 31 16:29u
			8:00	-	SGT
Zone	Test/Singapore/0000wall_as_utc	7:30	-	SGT	1981 Dec 31 16:30u
			8:00	-	SGT
Zone	Test/Singapore/0001wall_as_utc	7:30	-	SGT	1981 Dec 31 16:31u
			8:00	-	SGT

Zone	Test/Singapore/Something_Else	7:30	-	SGT	1981 Dec 31 19:45u
			8:00	-	SGT

################################################################################

# The real Asia/Dhaka zone.
#
# Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
Rule	Dhaka	2009	only	-	Jun	19	23:00	1:00	S
Rule	Dhaka	2009	only	-	Dec	31	24:00	0	-
# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
Zone	Asia/Dhaka	6:01:40 -	LMT	1890
			5:53:20	-	HMT	1941 Oct    # Howrah Mean Time?
			6:30	-	BURT	1942 May 15 # Burma Time
			5:30	-	IST	1942 Sep
			6:30	-	BURT	1951 Sep 30
			6:00	-	DACT	1971 Mar 26 # Dacca Time
			6:00	-	BDT	2009
			6:00	Dhaka	BD%sT


# Some test cases for zdump.
# Each of these should result in a transition in either 2009 or 2010.
# That is, a Dec 2009 or Jan 2010 transition should appear either with
#   zdump -vc 2009,2010 ZONE_NAME
# or with
#   zdump -vc 2010,2011 ZONE_NAME
#
# Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
Rule	2359utc	2009	only	-	Jun	19	23:00u	1:00	S
Rule	2359utc	2009	only	-	Dec	31	23:59u	0	-
Zone	Test/Dhaka/2359utc	6:00	2359utc	BD%sT
Rule	2400utc	2009	only	-	Jun	19	23:00u	1:00	S
Rule	2400utc	2009	only	-	Dec	31	24:00u	0	-
Zone	Test/Dhaka/2400utc	6:00	2400utc	BD%sT
Rule	0000utc	2009	only	-	Jun	19	23:00u	1:00	S
Rule	0000utc	2010	only	-	Jan	 1	 0:00u	0	-
Zone	Test/Dhaka/0000utc	6:00	0000utc	BD%sT
Rule	0001utc	2009	only	-	Jun	19	23:00u	1:00	S
Rule	0001utc	2010	only	-	Jan	 1	 0:01u	0	-
Zone	Test/Dhaka/0001utc	6:00	0001utc	BD%sT	# Works

Rule	2359wall	2009	only	-	Jun	19	23:00	1:00	S
Rule	2359wall	2009	only	-	Dec	31	23:59	0	-
Zone	Test/Dhaka/2359wall	6:00	2359wall	BD%sT	# Works
Rule	2400wall	2009	only	-	Jun	19	23:00	1:00	S
Rule	2400wall	2009	only	-	Dec	31	24:00	0	-
Zone	Test/Dhaka/2400wall	6:00	2400wall	BD%sT	# Works
Rule	0000wall	2009	only	-	Jun	19	23:00	1:00	S
Rule	0000wall	2010	only	-	Jan	 1	 0:00	0	-
Zone	Test/Dhaka/0000wall	6:00	0000wall	BD%sT	# Works
Rule	0001wall	2009	only	-	Jun	19	23:00	1:00	S
Rule	0001wall	2010	only	-	Jan	 1	 0:01	0	-
Zone	Test/Dhaka/0001wall	6:00	0001wall	BD%sT

Rule	2359wall_as_utc	2009	only	-	Jun	19	17:00u	1:00	S
Rule	2359wall_as_utc	2009	only	-	Dec	31	16:59u	0	-
Zone	Test/Dhaka/2359wall_as_utc	6:00	2359wall_as_utc	BD%sT	# Works
Rule	0000wall_as_utc	2009	only	-	Jun	19	17:00u	1:00	S
Rule	0000wall_as_utc	2009	only	-	Dec	31	17:00u	0	-
Zone	Test/Dhaka/0000wall_as_utc	6:00	0000wall_as_utc	BD%sT	# Works
Rule	0001wall_as_utc	2009	only	-	Jun	19	17:00u	1:00	S
Rule	0001wall_as_utc	2009	only	-	Dec	31	17:01u	0	-
Zone	Test/Dhaka/0001wall_as_utc	6:00	0001wall_as_utc	BD%sT

Rule	Something_Else	2009	only	-	Jun	19	17:00u	1:00	S
Rule	Something_Else	2009	only	-	Dec	31	19:45u	0	-
Zone	Test/Dhaka/Something_Else	6:00	Something_Else	BD%sT



More information about the tz mailing list