[comp.bugs.4bsd.ucb-fixes] ARTICLE #15

bostic@OKEEFFE.BERKELEY.EDU.UUCP (03/27/87)

The next four articles posted to comp.bugs.4bsd.ucb-fixes, ARTICLES
#13 through #16, will concern the upcoming DST problem.  They contain:

ARTICLE #13	A minimal fix, hopefully easy to install.  It contains
		fixes for both 4.2 and 4.3 BSD systems.  To install
		this fix, unshar ARTICLE #13 in an empty directory and
		follow the instructions contained in the README file.

ARTICLES #14, #15, #16
		What Berkeley has installed.  To install this fix, create a
		directory containing one other directory; the sub-directory
		should be called "tzone".  Unshar ARTICLES #15 and #16 in
		this sub-directory.  Unshar ARTICLE #14 in the top directory.
		Follow the instructions contained in the README file.

You are reading ARTICLE #15.

If you have any problems getting either package to work,
please contact me.

Keith Bostic
bostic@ucbvax.berkeley.edu
ucbvax!bostic
seismo!keith
+1 (415) 642-4948

... cut here ...

echo x - Makefile
sed 's/^X//' >Makefile << 'END-of-Makefile'
X# @(#)Makefile	1.1 Makefile 3/4/87
X
XDESTDIR=
X
X# If you want something other than Eastern United States time used on your
X# system, change the line below (after finding the zone you want in the
X# time zone files, or adding it to a time zone file).
X# Alternately, if you discover you've got the wrong time zone, you can just
X#	zic -l rightzone
X
XLOCALTIME=	US/Pacific
X
X# If you want code inspired by certain emerging standards, add
X#	-DSTD_INSPIRED
X# to the end of the "CFLAGS=" line.
X#
X# If you want to handle solar-time-based time zones, remove the
X# "#define NOSOLAR" from the include file usr/include/tzfile.h.
X# (and add solar87 to the DATA= line below).
X
XCFLAGS= -O
X
X# LINTFLAGS is set for 4.[123]BSD systems.
X# If you're using System V, you'll want to comment out the "LINTFLAGS=" line.
X
XLINTFLAGS=	-phbaaxc
X
X# BUNDLE was set to "bundle" in the original, "shar" is more universal
X
XBUNDLE=		shar
X
X################################################################################
X
XCC=		cc
X
XTZCSRCS=	zic.c scheck.c ialloc.c
XTZCOBJS=	zic.o scheck.o ialloc.o
XTZDSRCS=	zdump.c ialloc.c
XTZDOBJS=	zdump.o ialloc.o
XDOCS=		Theory README Makefile newctime.3 tzfile.5 zic.8 zdump.8
XSOURCES=	zic.c zdump.c scheck.c ialloc.c
XDATA=		asia australasia europe etcetera northamerica \
X		pacificnew systemv
XENCHILADA=	$(DOCS) $(SOURCES) $(DATA)
X
Xall:		zdump zic
X
Xinstall:	zic $(DATA)
X		./zic -d ${DESTDIR}/etc/zoneinfo -l $(LOCALTIME) $(DATA)
X
Xzdump:		$(TZDOBJS)
X		$(CC) $(CFLAGS) $(LFLAGS) $(TZDOBJS) -o $@
X
Xzic:		$(TZCOBJS)
X		$(CC) $(CFLAGS) $(LFLAGS) $(TZCOBJS) -o $@
X
XBUNDLES:	BUNDLE1 BUNDLE2 BUNDLE3
X
XBUNDLE1:	$(DOCS)
X		$(BUNDLE) $(DOCS) > $@
X
XBUNDLE2:	$(SOURCES)
X		$(BUNDLE) $(SOURCES) > $@
X
XBUNDLE3:	$(DATA)
X		$(BUNDLE) $(DATA) > $@
X
X$(ENCHILADA):
X		sccs get $(REL) $(REV) $@
X
Xsure:		$(TZCSRCS) $(TZDSRCS)
X		lint $(LINTFLAGS) $(CFLAGS) $(TZCSRCS)
X		lint $(LINTFLAGS) $(CFLAGS) $(TZDSRCS)
X
Xclean:
X		rm -f core *.o *.out REDID_BINARIES zdump zic BUNDLE* \#*
X
XCLEAN:		clean
X		sccs clean
X
Xlisting:	$(ENCHILADA)
X		pr $(ENCHILADA) | lpr
X
END-of-Makefile
echo x - README
sed 's/^X//' >README << 'END-of-README'
X@(#)README	3.1
X
XPlease send comments or information to
X	seismo!elsie!tz
Xfor forwarding to folks interested in time zone matters.
X
XBe sure to read the comments in "Makefile" and make any changes
Xneeded to make things right for your system.
X
XThis version of the time zone software uses a new format
X(based on the work of Guy Harris, a.k.a guy@sun.UUCP)
Xfor the time zone information files.  They are now stored by default in a
Xdirectory named "/etc/zoneinfo" rather than "/etc/tzdir" or "/etc/timezones"
Xas before.  If you've already compiled programs with older time zone software,
Xjust leave the "/etc/tzdir" and/or "/etc/timezones" files around until you
Xhave a chance to recompile.
X
XFor better compatability with other versions of time conversion functions,
Xthe time zone abbreviation to be used with localtime's return value is now
Xpointed to by one of the two elements of the (char *) array tzname, rather
Xthan by the (char *) tz_abbr.  If you have code that uses tz_abbr, add a
X	-DTZA_COMPAT
Xto the end of the
X	CFLAGS=
Xline in "Makefile".
X
XTo use the new functions, use a "-lz" option when compiling or linking.
X
XHistorical local time information has been included here not because it
Xis particularly useful, but rather to:
X
X*	give an idea of the variety of local time rules that have
X	existed in the past and thus an idea of the variety that may be
X	expected in the future;
X
X*	provide a test of the generality of the local time rule description
X	system.
X
XThe information in the time zone data files is by no means authoritative;
Xif you know that the rules are different from those in a file, by all means
Xfeel free to change file (and please send the changed version to seismo!elsie!tz
Xfor use in the future).  Europeans take note!
END-of-README
echo x - Theory
sed 's/^X//' >Theory << 'END-of-Theory'
X@(#)Theory	3.1
X
XThese time and date functions are much like the System V Release 2.0 (SVR2)
Xtime and date functions; there are a few additions and changes to extend
Xthe usefulness of the SVR2 functions:
X
X*	In SVR2, time display in a process is controlled by the environment
X	variable TZ, which "must be a three-letter time zone name, followed
X	by a number representing the difference between local time and
X	Greenwich Mean Time in hours, followed by an optional three-letter
X	name for a daylight time zone;" when the optional daylight time zone is
X	present, "standard U.S.A. Daylight Savings Time conversion is applied."
X	This means that SVR2 can't deal with other (for example, Australian) 
X	daylight savings time rules, or situations where more than two
X	time zone abbreviations are used in an area.
X
X*	In SVR2, time conversion information is compiled into each program
X	that does time conversion.  This means that when time conversion
X	rules change (as in the United States in 1987), all programs that
X	do time conversion must be recompiled to ensure proper results.
X
X*	In SVR2, time conversion fails for near-minimum or near-maximum
X	time_t values when doing conversions for places that don't use GMT.
X
X*	In SVR2, there's no tamper-proof way for a process to learn the
X	system's best idea of local wall clock.  (This is important for 
X	applications that an administrator wants used only at certain times--
X	without regard to whether the user has fiddled the "TZ" environment
X	variable.  While an administrator can "do everything in GMT" to get
X	around the problem, doing so is inconvenient and precludes handling
X	daylight savings time shifts--as might be required to limit phone
X	calls to off-peak hours.)
X
XThese are the changes that have been made to the SVR2 functions:
X
X*	The "TZ" environment variable is used in generating the name of a file
X	from which time zone information is read; "TZ" is no longer constrained
X	to be a three-letter time zone name followed by a number of hours and
X	an optional three-letter daylight time zone name.  The daylight saving
X	time rules to be used for a particular time zone are encoded in the
X	time zone file; the format of the file allows U.S., Australian, and
X	other rules to be encoded, and allows for situations where more than
X	two time zone abbreviations are used.
X
X	It was recognized that allowing the "TZ" environment variable to
X	take on values such as "US/Eastern" might cause "old" programs
X	(that expect "TZ" to have a certain form) to operate incorrectly;
X	consideration was given to using some other environment variable
X	(for example, "TIMEZONE") to hold the string used to generate the
X	time zone information file name.  In the end, however, it was decided
X	to continue using "TZ":  it is widely used for time zone purposes;
X	separately maintaining both "TZ" and "TIMEZONE" seemed a nuisance;
X	and systems where "new" forms of "TZ" might cause problems can simply
X	give time zone files names such as "EST5EDT" which can be used both by
X	"new" programs (as file names) and "old" programs (as zone names and
X	offsets).
X
X*	To handle places where more than two time zone abbreviations are used,
X	the functions "localtime" and "gmtime" set tzname[tmp->tm_isdst]
X	(where "tmp" is the value the function returns) to the time zone
X	abbreviation to be used.  This differs from SVR2, where the elements
X	of tzname are only changed as a result of calls to tzset.
X
X*	Since the "TZ" environment variable can now be used to control time
X	conversion, the "daylight" and "timezone" variables are no longer
X	needed or supported.  (You can use a compile-time option to cause
X	these variables to be defined and to be set by "tzset"; however, their
X	values will not be used by "localtime.")
X
X*	The "localtime" function has been set up to deliver correct results
X	for near-minimum or near-maximum time_t values.  (A comment in the
X	source code tells how to get compatibly wrong results).
X
X*	A function "tzsetwall" has been added to arrange for the system's
X	best approximation to local wall clock time to be delivered by
X	subsequent calls to "localtime."  Source code for portable
X	applications that "must" run on local wall clock time should call
X	"tzsetwall();" if such code is moved to "old" systems that don't provide
X	tzsetwall, you won't be able to generate an executable program.
X	(These time zone functions also arrange for local wall clock time to be
X	used if tzset is called--directly or indirectly--and there's no "TZ"
X	environment variable; portable applications should not, however, rely
X	on this behavior since it's not the way SVR2 systems behave.)
X
XPoints of interest to folks with Version 7 or BSD systems:
X
X*	The BSD "timezone" function is not present in this package;
X	it's impossible to reliably map timezone's arguments (a "minutes west
X	of GMT" value and a "daylight saving time in effect" flag) to a
X	time zone abbreviation, and we refuse to guess. 
X	Programs that in the past used the timezone function may now examine
X	tzname[localtime(&clock)->tm_isdst] to learn the correct time
X	zone abbreviation to use.  Alternatively, use localtime(&clock)->tm_zone
X	if this has been enabled.
X
X*	The BSD gettimeofday function is not used in this package;
X	this lets users control the time zone used in doing time conversions.
X	Users who don't try to control things (that is, users who do not set
X	the environment variable TZ) get the time conversion specified in the
X	file "/etc/zoneinfo/localtime"; see the time zone compiler writeup for
X	information on how to initialize this file.
X
X*	The BSD "dysize" function is only included if the preprocessor symbol
X	BSD_COMPAT is defined.  For a year y, the BSD code returns the value
X	   ((y % 4) == 0) : 366 : 365
X	while this code returns the value
X	   (((y) % 4) == 0 && ((y) % 100) != 0 || ((y) % 400) == 0) ? 366 : 365
X	There's a comment in the code telling how to get the BSD value.
X
XThe functions that are conditionally compiled if STD_INSPIRED is defined should,
Xat this point, be looked on primarily as food for thought.  They are not in
Xany sense "standard compatible"--some are not, in fact, specified in *any*
Xstandard.  They do, however, represent responses of various authors to
Xstandardization proposals.
X
XOther time conversion proposals, in particular the one developed by folks at
XHewlett Packard, offer a wider selection of functions that provide capabilities
Xbeyond those provided here.  The absence of such functions from this package
Xis not meant to discourage the development, standardization, or use of such
Xfunctions.  Rather, their absence reflects the decision to make this package
Xclose to SVR2 (with the exceptions outlined above) to ensure its broad
Xacceptability.  If more powerful time conversion functions can be standardized,
Xso much the better.
X
XIt's probably not wise to standardize everything in this package.
XWhile the command
X	nroff -man newctime.3
Xproduces a document that describes this package, the command
X	nroff -man -rX3J11 newctime.3
Xproduces a document that describes the "standardizable" parts.
END-of-Theory
echo x - asia
sed 's/^X//' >asia << 'END-of-asia'
X# @(#)asia	3.1
X# Incorporates data for Singapore from Robert Elz' asia 1.1
X# Zone	NAME		GMTOFF	RULES/SAVE	FORMAT	[UNTIL]
XZone	Japan		9:00	-		JST
XZone	Singapore	8:00	-		SST
END-of-asia
echo x - australasia
sed 's/^X//' >australasia << 'END-of-australasia'
X# @(#)australasia	3.1
X# Incorporates updates for Australia from Robert Elz' australia 1.1
X# and further updates from the Australian consulate.
X
X# Australian Data (for states with DST), standard rules
X# Includes shift in 1987 to follow Vic/NSW rules for ending DST,
X# and shift in 1986 to start DST earlier.
X
X# Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
XRule	Oz	1971	1985	-	Oct	lastSun	2:00	1:00	-
XRule	Oz	1986	max	-	Oct	Sun<=24	2:00	1:00	-
XRule	Oz	1972	only	-	Feb	27	3:00	0	-
XRule	Oz	1973	1986	-	Mar	Sun>=1	3:00	0	-
XRule	Oz	1987	max	-	Mar	Sun<=21	3:00	0	-
X
X# Zone	NAME			GMTOFF	RULES	FORMAT	[UNTIL]
XZone	Australia/Tasmania	10:00	Oz	EST
XZone	Australia/Queensland	10:00	-	EST	# No DST here
XZone	Australia/North		9:30	-	CST	# No DST here
XZone	Australia/West		8:00	-	WST	# No DST here
XZone	Australia/South		9:30	Oz	CST
X
X# Victoria and New South Wales made the jump to a later ending date for
X# DST in 1986 rather than 1987.  New South Wales also had another variation
X# in 1983, but the details of that are unknown to the authors at this time.
X
XZone	Australia/Victoria	10:00	Oz	EST	1985 Oct lastSun 2:00
X				10:00	1:00	EST	1986 Mar Sun<=21 3:00
X				10:00	Oz	EST
XLink	Australia/Victoria	Australia/NSW
X
X# New Zealand, from Elz' asia 1.1
X# Elz says "no guarantees"
X# Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
XRule	NZ	1974	max	-	Oct	lastSun	2:00	1:00	D
XRule	NZ	1975	max	-	Mar	Sun>=1	3:00	0	S
X
X# Zone	NAME			GMTOFF	RULES/SAVE	FORMAT	[UNTIL]
XZone	NZ			12:00	NZ		NZ%sT	# New Zealand
X
X#
X# A footnote here:
X#
X#	. . .
X#	Date: Thu, j19 Feb 87 12:02:17 EST
X#	From: Bradley White <seismo!k.cs.cmu.edu!bww>
X#	. . .
X#	I am including a description of Australian time zones. . .
X#	this stuff is definitely accurate.
X#	. . .
X#	a) Australian Eastern Time: (EST = GMT+10:00, EDT = GMT+11:00)
X#	. . .
X#	Summer of 86/87 - present (current legislation):
X#		third Sun Oct 02:00 EST -> third LSun Mar 02:00 EST
X#
X# If this turns out to be true, substitute Sun<=21 (third Sunday in October)
X# for Sun<=24 (next-to-last Sunday in October) above. . .some time before
X# October 1988, the first time it makes a difference.
X#
END-of-australasia
echo x - etcetera
sed 's/^X//' >etcetera << 'END-of-etcetera'
X# @(#)etcetera	3.1
X
XZone	GMT		0	-	GMT
X
X#
X# Names for zones that might exist, just so people can set a timezone
X# that's right for their area, even if it doesn't have a name or dst rules
X# (half hour zones are too much to bother with -- when someone asks!)
X#
X
XZone	GMT-12		-12	-	GMT-1200
XZone	GMT-11		-11	-	GMT-1100
XZone	GMT-10		-10	-	GMT-1000
XZone	GMT-9		-9	-	GMT-0900
XZone	GMT-8		-8	-	GMT-0800
XZone	GMT-7		-7	-	GMT-0700
XZone	GMT-6		-6	-	GMT-0600
XZone	GMT-5		-5	-	GMT-0500
XZone	GMT-4		-4	-	GMT-0400
XZone	GMT-3		-3	-	GMT-0300
XZone	GMT-2		-2	-	GMT-0200
XZone	GMT-1		-1	-	GMT-0100
XZone	GMT+1		1	-	GMT+0100
XZone	GMT+2		2	-	GMT+0200
XZone	GMT+3		3	-	GMT+0300
XZone	GMT+4		4	-	GMT+0400
XZone	GMT+5		5	-	GMT+0500
XZone	GMT+6		6	-	GMT+0600
XZone	GMT+7		7	-	GMT+0700
XZone	GMT+8		8	-	GMT+0800
XZone	GMT+9		9	-	GMT+0900
XZone	GMT+10		10	-	GMT+1000
XZone	GMT+11		11	-	GMT+1100
XZone	GMT+12		12	-	GMT+1200
XZone	GMT+13		13	-	GMT+1300	# GMT+12 with DST
X
XLink	GMT		UTC
XLink	GMT		UCT
XLink	GMT		Universal
XLink	GMT		Greenwich
END-of-etcetera
echo x - europe
sed 's/^X//' >europe << 'END-of-europe'
X# @(#)europe	3.1
X
X# Europe, updated from 4.3BSD and various contributors
X# International country codes are used to identify countries' rules and
X# zones
X#
X# This data is by no means authoritative; if you think you know better, go
X# ahead and edit the file (and please send any changes to seismo!elsie!tz
X# for general use in the future).  The use of 1986 as starting years below
X# is conservative.
X#
X# One source shows that Bulgaria, Cyprus, Finland, and Greece observe DST from
X# the last Sunday in March to the last Sunday in September in 1986.
X# The source shows Romania changing a day later than everybody else.
X#
X# According to Bernard Sieloff's source, Poland is in the MET time zone but
X# uses the WE DST rules.  The Western USSR uses EET+1 and ME DST rules.
X# Bernard Sieloff's source claims Romania switches on the same day, but at
X# 00:00 standard time (i.e., 01:00 DST).  It also claims that Turkey
X# switches on the same day, but switches on at 01:00 standard time
X# and off at 00:00 standard time (i.e., 01:00 DST)
X
X# Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
XRule	GB-Eire	1986	max	-	Mar	lastSun	1:00s	1:00	BST
XRule	GB-Eire	1986	max	-	Oct	lastSun	1:00s	0	GMT
X
XRule	W-Eur	1986	max	-	Mar	lastSun	1:00s	1:00	" DST"
XRule	W-Eur	1986	max	-	Sep	lastSun	1:00s	0	-
X
XRule	M-Eur	1986	max	-	Mar	lastSun	2:00s	1:00	" DST"
XRule	M-Eur	1986	max	-	Sep	lastSun	2:00s	0	-
X
XRule	E-Eur	1986	max	-	Mar	lastSun	3:00s	1:00	" DST"
XRule	E-Eur	1986	max	-	Sep	lastSun	3:00s	0	-
X
XRule	Turkey	1986	max	-	Mar	lastSun	1:00	1:00	" DST"
XRule	Turkey	1986	max	-	Sep	lastSun	1:00	0	-
X
XRule	W-SU	1986	max	-	Mar	lastSun	2:00s	1:00	" DST"
XRule	W-SU	1986	max	-	Sep	lastSun	2:00s	0	-
X
X# Zone	NAME		GMTOFF	RULES/SAVE	FORMAT	[UNTIL]
XZone	GB-Eire		0:00	GB-Eire		%s
XZone	WET		0:00	W-Eur		WET%s
XZone	Iceland		0:00	-		WET
XZone	MET		1:00	M-Eur		MET%s
XZone	Poland		1:00	W-Eur		MET%s
XZone	EET		2:00	E-Eur		EET%s
XZone	Turkey		3:00	Turkey		EET%s
XZone	W-SU		3:00	M-Eur		????
X
X# Tom Hoffman says that MET is also known as Central European Time
X
XLink	MET	CET
X
X#
X# And now, letters on the subject. . .
X#
X###############################################################################
X#
X# ...
X# Date: Wed, 28 Jan 87 16:56:27 -0100
X# From: seismo!mcvax!cgcha!wtho (Tom Hofmann)
X# Message-Id: <8701281556.AA22174@cgcha.uucp>
X# ...
X# Subject: Time zone handling
X# ...
X# 
X# ...the European time rules are...standardized since 1981, when
X# most European counrties started DST.  Before that year, only
X# a few countries (UK, France, Italy) had DST, each according
X# to own national rules.  In 1981, however, DST started on
X# 'Apr firstSun', and not on 'Mar lastSun' as in the following
X# years...
X# But also since 1981 there are some more national exceptions 
X# than listed in 'europe': Switzerland, for example, joined DST 
X# one year later, Denmark ended DST on 'Oct 1' instead of 'Sep 
X# lastSun' in 1981---I don't know how they handle now.
X# 
X# Finally, DST ist always from 'Apr 1' to 'Oct 1' in the
X# Soviet Union (as far as I know).  
X# 
X# Tom Hofmann, Scientific Computer Center, CIBA-GEIGY AG,
X# 4002 Basle, Switzerland
X# UUCP: ...!mcvax!cernvax!cgcha!wtho
X#
X###############################################################################
X# 
X# ...
X# Date: Wed, 4 Feb 87 22:35:22 +0100
X# From: seismo!mcvax!cwi.nl!dik (Dik T. Winter)
X# Message-Id: <8702042135.AA23919@zuring.cwi.nl>
X# ...
X# Subject: timezones
X# ...
X# 
X# The information from Tom Hofmann is (as far as I know) not entirely correct.
X# After a request from chongo at amdahl I tried to retrieve all information
X# about DST in Europe.  I was able to find all from about 1969.
X# 
X# ...standardization
X# on DST in Europe started in about 1977 with switches on first Sunday in
X# April and last Sunday in September.  In UK it was from last but 1 Sunday
X# in march to last Sunday in October.  In 1981 UK joined Europe insofar that
X# the starting day for both shifted to last Sunday in March.  And from 1982
X# the whole of Europe used DST, with switch dates April 1 and October 1 in
X# the Sovjet Union.  In 1985 the SU reverted to standard Europen switch
X# dates.  Note that currently in the UK the switch back date appears not
X# to be the last Sunday in October, but 4 weeks after the last Sunday in
X# September (withness 1982 and 1983 with terminating days October 24 and 23).
X# 
X# It should also be remembered that time-zones are not constants; e.g.
X# Portugal switched in 1976 from MET (or CET) to WET with DST, and the UK
X# used MET throughout from 1967 to 1969, and WET with DST before and after
X# that time.  Note also that though there were rules for switch dates not
X# all countries abided to these dates, and many individual deviations
X# occurred, though not since 1982 I believe.  Another note: it is always
X# assumed that DST is 1 hour ahead of normal time, this need not be the
X# case; at least in the Netherlands there have been times when DST was 2 hours
X# in advance of normal time.
X# 
X# ...
X# dik t. winter, cwi, amsterdam, nederland
X# INTERNET   : dik@cwi.nl
X# BITNET/EARN: dik@mcvax
END-of-europe
echo x - ialloc.c
sed 's/^X//' >ialloc.c << 'END-of-ialloc.c'
X/*
X *	@(#)ialloc.c	1.1 ialloc.c 3/4/87
X */
X
X/*LINTLIBRARY*/
X
X#include "stdio.h"
X
X#ifndef alloc_t
X#define alloc_t	unsigned
X#endif /* !alloc_t */
X
X#ifdef MAL
X#define NULLMAL(x)	((x) == NULL || (x) == MAL)
X#else /* !MAL */
X#define NULLMAL(x)	((x) == NULL)
X#endif /* !MAL */
X
Xextern char *	calloc();
Xextern char *	malloc();
Xextern char *	realloc();
Xextern char *	strcpy();
X
Xchar *
Ximalloc(n)
X{
X#ifdef MAL
X	register char *	result;
X
X	if (n == 0)
X		n = 1;
X	result = malloc((alloc_t) n);
X	return (result == MAL) ? NULL : result;
X#else /* !MAL */
X	if (n == 0)
X		n = 1;
X	return malloc((alloc_t) n);
X#endif /* !MAL */
X}
X
Xchar *
Xicalloc(nelem, elsize)
X{
X	if (nelem == 0 || elsize == 0)
X		nelem = elsize = 1;
X	return calloc((alloc_t) nelem, (alloc_t) elsize);
X}
X
Xchar *
Xirealloc(pointer, size)
Xchar *	pointer;
X{
X	if (NULLMAL(pointer))
X		return imalloc(size);
X	if (size == 0)
X		size = 1;
X	return realloc(pointer, (alloc_t) size);
X}
X
Xchar *
Xicatalloc(old, new)
Xchar *	old;
Xchar *	new;
X{
X	register char *	result;
X	register	oldsize, newsize;
X
X	oldsize = NULLMAL(old) ? 0 : strlen(old);
X	newsize = NULLMAL(new) ? 0 : strlen(new);
X	if ((result = irealloc(old, oldsize + newsize + 1)) != NULL)
X		if (!NULLMAL(new))
X			(void) strcpy(result + oldsize, new);
X	return result;
X}
X
Xchar *
Xicpyalloc(string)
Xchar *	string;
X{
X	return icatalloc((char *) NULL, string);
X}
X
Xifree(p)
Xchar *	p;
X{
X	if (!NULLMAL(p))
X		free(p);
X}
END-of-ialloc.c
echo x - northamerica
sed 's/^X//' >northamerica << 'END-of-northamerica'
X# @(#)northamerica	3.1
X
X# Despite the performance of existing (4.[123]BSD, System V Release 2.0) code,
X# US Daylight Saving Time ended on the last Sunday of *October* in 1974.
X# See, for example, the front page of the Saturday, October 26, 1974
X# and Sunday, October 27, 1974 editions of the Washington Post.
X
X# Note also this from seismo!munnari!kre:
X# "I recall also being told by someone once that Canada didn't have
X# the DST variations in 74/75 that the US did, but I am not nearly
X# sure enough of this to add anything."
X# The above has been confirmed by Bob Devine; we'll go with it here.
X
X# Before the Uniform Time Act of 1966 took effect in 1967, observance of
X# Daylight Saving Time in the US was by local option, except during wartime.
X
X# Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
XRule	US	1918	1919	-	Mar	lastSun	2:00	1:00	D
XRule	US	1918	1919	-	Oct	lastSun	2:00	0	S
XRule	US	1942	only	-	Feb	9	2:00	1:00	W # War
XRule	US	1945	only	-	Sep	30	2:00	0	S
XRule	US	1967	max	-	Oct	lastSun	2:00	0	S
XRule	US	1967	1973	-	Apr	lastSun	2:00	1:00	D
XRule	US	1974	only	-	Jan	6	2:00	1:00	D
XRule	US	1975	only	-	Feb	23	2:00	1:00	D
XRule	US	1976	1986	-	Apr	lastSun	2:00	1:00	D
XRule	US	1987	max	-	Apr	Sun>=1	2:00	1:00	D
X
X###############################################################################
X
X# New names
X
X# Zone	NAME		GMTOFF	RULES/SAVE	FORMAT	 [UNTIL]
XZone	US/Eastern	-5:00	US		E%sT
XZone	US/Central	-6:00	US		C%sT
XZone	US/Mountain	-7:00	US		M%sT
XZone	US/Pacific	-8:00	US		P%sT
XZone	US/Yukon	-9:00	US		Y%sT
X
X# Mainland US areas that are always Standard as of 1986.
X
XZone	US/East-Indiana	-5:00	US	E%sT	1946
X			-5:00	-	EST		# Always EST as of 1986
XZone	US/Arizona	-7:00	US	M%sT	1946
X			-7:00	-	MST		# Always MST as of 1986
X
X# And then there's Hawaii.
X# DST was observed for one day in 1933;
X# Standard time was change by half an hour in 1947;
X# it's always standard as of 1986.
X
XZone	US/Hawaii	-10:30	US	H%sT	1933 Apr 30 2:00
X			-10:30	1:00	HDT	1933 May 1 2:00
X			-10:30	US	H%sT	1947 Jun 8 2:00
X			-10:00	-	HST
X
X# Old names, for S5 users
X
X# Link	LINK-FROM	LINK-TO
XLink	US/Eastern	EST5EDT
XLink	US/Central	CST6CDT
XLink	US/Mountain	MST7MDT
XLink	US/Pacific	PST8PDT
XLink	US/East-Indiana	EST
XLink	US/Arizona	MST
XLink	US/Hawaii	HST
X
X################################################################################
X
X# Canada is reportedly lots easier than the US--leastways since 1951.
X# I don't know what they did before then.
X# 4.3BSD claims that it's perfectly regular.
X# According to a posting in "comp.bugs.misc", "comp.unix.wizards", etc.
X# on February 8, 1987, by Dave Sherman of the Law Society of Upper Canada,
X# "...Canada (well, Ontario and at least some of the other provinces) are
X# adopting the new daylight savings time rules...".  We assume all of
X# Canada is doing so.
X
X# Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
XRule	Canada	1969	max	-	Oct	lastSun	2:00	0	S
XRule	Canada	1969	1986	-	Apr	lastSun	2:00	1:00	D
XRule	Canada	1987	max	-	Apr	Sun>=1	2:00	1:00	D
X
X# Zone	NAME			GMTOFF	RULES/SAVE	FORMAT	[UNTIL]
X# Bob Devine says that DST *is* observed in Newfoundland
XZone	Canada/Newfoundland	-3:30	Canada		N%sT
XZone	Canada/Atlantic		-4:00	Canada		A%sT
XZone	Canada/Eastern		-5:00	Canada		E%sT
XZone	Canada/Central		-6:00	Canada		C%sT
XZone	Canada/Mountain		-7:00	Canada		M%sT
XZone	Canada/Pacific		-8:00	Canada		P%sT
XZone	Canada/Yukon		-9:00	Canada		Y%sT
X
X################################################################################
X
X# ?Mexico?  !Quien sabe!
END-of-northamerica
echo x - pacificnew
sed 's/^X//' >pacificnew << 'END-of-pacificnew'
X# @(#)pacificnew	3.1
X
X# "Pacific Presidential Election Time" has been contemplated by the US Congress
X
X# Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
XRule	Twilite	1987	max	-	Apr	Sun>=1	2:00	1:00	D
XRule	Twilite	1987	max	uspres	Oct	lastSun	2:00	1:00	PE
XRule	Twilite	1987	max	uspres	Nov	Sun>=7	2:00	0	S
XRule	Twilite	1987	max	nonpres	Oct	lastSun	2:00	0	S
X
X# Zone	NAME		GMTOFF	RULES/SAVE	FORMAT	[UNTIL]
XZone	US/Pacific-New	-8:00	US		P%sT	1987
X			-8:00	Twilite		P%sT
END-of-pacificnew
echo x - scheck.c
sed 's/^X//' >scheck.c << 'END-of-scheck.c'
X/*
X *	@(#)scheck.c	1.1 scheck.c 3/4/87
X */
X
X/*LINTLIBRARY*/
X
X#include "stdio.h"
X#include "ctype.h"
X
Xextern char *	imalloc();
X
Xchar *
Xscheck(string, format)
Xchar *	string;
Xchar *	format;
X{
X	register char *	fbuf;
X	register char *	fp;
X	register char *	tp;
X	register int	c;
X	register char *	result;
X	char		dummy;
X
X	result = "";
X	if (string == NULL || format == NULL)
X		return result;
X	fbuf = imalloc(2 * strlen(format) + 4);
X	if (fbuf == NULL)
X		return result;
X	fp = format;
X	tp = fbuf;
X	while ((*tp++ = c = *fp++) != '\0') {
X		if (c != '%')
X			continue;
X		if (*fp == '%') {
X			*tp++ = *fp++;
X			continue;
X		}
X		*tp++ = '*';
X		if (*fp == '*')
X			++fp;
X		while (isascii(*fp) && isdigit(*fp))
X			*tp++ = *fp++;
X		if (*fp == 'l' || *fp == 'h')
X			*tp++ = *fp++;
X		else if (*fp == '[')
X			do *tp++ = *fp++;
X				while (*fp != '\0' && *fp != ']');
X		if ((*tp++ = *fp++) == '\0')
X			break;
X	}
X	*(tp - 1) = '%';
X	*tp++ = 'c';
X	*tp = '\0';
X	if (sscanf(string, fbuf, &dummy) != 1)
X		result = format;
X	free(fbuf);
X	return result;
X}
END-of-scheck.c
echo x - solar87
sed 's/^X//' >solar87 << 'END-of-solar87'
X# @(#)solar87	3.1
X
X# So much for footnotes about Saudi Arabia.
X# Apparent noon times below are for Riyadh; your mileage will vary.
X# Times were computed using formulas in the U.S. Naval Observatory's
X# Almanac for Computers 1987; the formulas "will give EqT to an accuracy of
X# [plus or minus] two seconds during the current year."
X#
X# Rounding to the nearest five seconds results in fewer than
X# 256 different "time types"--a limit that's faced because time types are
X# stored on disk as unsigned chars.
X
X# Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
XRule	sol87	1987	only	-	Jan	1	12:03:20s -0:03:20 -
XRule	sol87	1987	only	-	Jan	2	12:03:50s -0:03:50 -
XRule	sol87	1987	only	-	Jan	3	12:04:15s -0:04:15 -
XRule	sol87	1987	only	-	Jan	4	12:04:45s -0:04:45 -
XRule	sol87	1987	only	-	Jan	5	12:05:10s -0:05:10 -
XRule	sol87	1987	only	-	Jan	6	12:05:40s -0:05:40 -
XRule	sol87	1987	only	-	Jan	7	12:06:05s -0:06:05 -
XRule	sol87	1987	only	-	Jan	8	12:06:30s -0:06:30 -
XRule	sol87	1987	only	-	Jan	9	12:06:55s -0:06:55 -
XRule	sol87	1987	only	-	Jan	10	12:07:20s -0:07:20 -
XRule	sol87	1987	only	-	Jan	11	12:07:45s -0:07:45 -
XRule	sol87	1987	only	-	Jan	12	12:08:10s -0:08:10 -
XRule	sol87	1987	only	-	Jan	13	12:08:30s -0:08:30 -
XRule	sol87	1987	only	-	Jan	14	12:08:55s -0:08:55 -
XRule	sol87	1987	only	-	Jan	15	12:09:15s -0:09:15 -
XRule	sol87	1987	only	-	Jan	16	12:09:35s -0:09:35 -
XRule	sol87	1987	only	-	Jan	17	12:09:55s -0:09:55 -
XRule	sol87	1987	only	-	Jan	18	12:10:15s -0:10:15 -
XRule	sol87	1987	only	-	Jan	19	12:10:35s -0:10:35 -
XRule	sol87	1987	only	-	Jan	20	12:10:55s -0:10:55 -
XRule	sol87	1987	only	-	Jan	21	12:11:10s -0:11:10 -
XRule	sol87	1987	only	-	Jan	22	12:11:30s -0:11:30 -
XRule	sol87	1987	only	-	Jan	23	12:11:45s -0:11:45 -
XRule	sol87	1987	only	-	Jan	24	12:12:00s -0:12:00 -
XRule	sol87	1987	only	-	Jan	25	12:12:15s -0:12:15 -
XRule	sol87	1987	only	-	Jan	26	12:12:30s -0:12:30 -
XRule	sol87	1987	only	-	Jan	27	12:12:40s -0:12:40 -
XRule	sol87	1987	only	-	Jan	28	12:12:55s -0:12:55 -
XRule	sol87	1987	only	-	Jan	29	12:13:05s -0:13:05 -
XRule	sol87	1987	only	-	Jan	30	12:13:15s -0:13:15 -
XRule	sol87	1987	only	-	Jan	31	12:13:25s -0:13:25 -
XRule	sol87	1987	only	-	Feb	1	12:13:35s -0:13:35 -
XRule	sol87	1987	only	-	Feb	2	12:13:40s -0:13:40 -
XRule	sol87	1987	only	-	Feb	3	12:13:50s -0:13:50 -
XRule	sol87	1987	only	-	Feb	4	12:13:55s -0:13:55 -
XRule	sol87	1987	only	-	Feb	5	12:14:00s -0:14:00 -
XRule	sol87	1987	only	-	Feb	6	12:14:05s -0:14:05 -
XRule	sol87	1987	only	-	Feb	7	12:14:10s -0:14:10 -
XRule	sol87	1987	only	-	Feb	8	12:14:10s -0:14:10 -
XRule	sol87	1987	only	-	Feb	9	12:14:15s -0:14:15 -
XRule	sol87	1987	only	-	Feb	10	12:14:15s -0:14:15 -
XRule	sol87	1987	only	-	Feb	11	12:14:15s -0:14:15 -
XRule	sol87	1987	only	-	Feb	12	12:14:15s -0:14:15 -
XRule	sol87	1987	only	-	Feb	13	12:14:15s -0:14:15 -
XRule	sol87	1987	only	-	Feb	14	12:14:15s -0:14:15 -
XRule	sol87	1987	only	-	Feb	15	12:14:10s -0:14:10 -
XRule	sol87	1987	only	-	Feb	16	12:14:10s -0:14:10 -
XRule	sol87	1987	only	-	Feb	17	12:14:05s -0:14:05 -
XRule	sol87	1987	only	-	Feb	18	12:14:00s -0:14:00 -
XRule	sol87	1987	only	-	Feb	19	12:13:55s -0:13:55 -
XRule	sol87	1987	only	-	Feb	20	12:13:50s -0:13:50 -
XRule	sol87	1987	only	-	Feb	21	12:13:45s -0:13:45 -
XRule	sol87	1987	only	-	Feb	22	12:13:35s -0:13:35 -
XRule	sol87	1987	only	-	Feb	23	12:13:30s -0:13:30 -
XRule	sol87	1987	only	-	Feb	24	12:13:20s -0:13:20 -
XRule	sol87	1987	only	-	Feb	25	12:13:10s -0:13:10 -
XRule	sol87	1987	only	-	Feb	26	12:13:00s -0:13:00 -
XRule	sol87	1987	only	-	Feb	27	12:12:50s -0:12:50 -
XRule	sol87	1987	only	-	Feb	28	12:12:40s -0:12:40 -
XRule	sol87	1987	only	-	Mar	1	12:12:30s -0:12:30 -
XRule	sol87	1987	only	-	Mar	2	12:12:20s -0:12:20 -
XRule	sol87	1987	only	-	Mar	3	12:12:05s -0:12:05 -
XRule	sol87	1987	only	-	Mar	4	12:11:55s -0:11:55 -
XRule	sol87	1987	only	-	Mar	5	12:11:40s -0:11:40 -
XRule	sol87	1987	only	-	Mar	6	12:11:25s -0:11:25 -
XRule	sol87	1987	only	-	Mar	7	12:11:15s -0:11:15 -
XRule	sol87	1987	only	-	Mar	8	12:11:00s -0:11:00 -
XRule	sol87	1987	only	-	Mar	9	12:10:45s -0:10:45 -
XRule	sol87	1987	only	-	Mar	10	12:10:30s -0:10:30 -
XRule	sol87	1987	only	-	Mar	11	12:10:15s -0:10:15 -
XRule	sol87	1987	only	-	Mar	12	12:09:55s -0:09:55 -
XRule	sol87	1987	only	-	Mar	13	12:09:40s -0:09:40 -
XRule	sol87	1987	only	-	Mar	14	12:09:25s -0:09:25 -
XRule	sol87	1987	only	-	Mar	15	12:09:10s -0:09:10 -
XRule	sol87	1987	only	-	Mar	16	12:08:50s -0:08:50 -
XRule	sol87	1987	only	-	Mar	17	12:08:35s -0:08:35 -
XRule	sol87	1987	only	-	Mar	18	12:08:15s -0:08:15 -
XRule	sol87	1987	only	-	Mar	19	12:08:00s -0:08:00 -
XRule	sol87	1987	only	-	Mar	20	12:07:40s -0:07:40 -
XRule	sol87	1987	only	-	Mar	21	12:07:25s -0:07:25 -
XRule	sol87	1987	only	-	Mar	22	12:07:05s -0:07:05 -
XRule	sol87	1987	only	-	Mar	23	12:06:50s -0:06:50 -
XRule	sol87	1987	only	-	Mar	24	12:06:30s -0:06:30 -
XRule	sol87	1987	only	-	Mar	25	12:06:10s -0:06:10 -
XRule	sol87	1987	only	-	Mar	26	12:05:55s -0:05:55 -
XRule	sol87	1987	only	-	Mar	27	12:05:35s -0:05:35 -
XRule	sol87	1987	only	-	Mar	28	12:05:15s -0:05:15 -
XRule	sol87	1987	only	-	Mar	29	12:05:00s -0:05:00 -
XRule	sol87	1987	only	-	Mar	30	12:04:40s -0:04:40 -
XRule	sol87	1987	only	-	Mar	31	12:04:25s -0:04:25 -
XRule	sol87	1987	only	-	Apr	1	12:04:05s -0:04:05 -
XRule	sol87	1987	only	-	Apr	2	12:03:45s -0:03:45 -
XRule	sol87	1987	only	-	Apr	3	12:03:30s -0:03:30 -
XRule	sol87	1987	only	-	Apr	4	12:03:10s -0:03:10 -
XRule	sol87	1987	only	-	Apr	5	12:02:55s -0:02:55 -
XRule	sol87	1987	only	-	Apr	6	12:02:35s -0:02:35 -
XRule	sol87	1987	only	-	Apr	7	12:02:20s -0:02:20 -
XRule	sol87	1987	only	-	Apr	8	12:02:05s -0:02:05 -
XRule	sol87	1987	only	-	Apr	9	12:01:45s -0:01:45 -
XRule	sol87	1987	only	-	Apr	10	12:01:30s -0:01:30 -
XRule	sol87	1987	only	-	Apr	11	12:01:15s -0:01:15 -
XRule	sol87	1987	only	-	Apr	12	12:00:55s -0:00:55 -
XRule	sol87	1987	only	-	Apr	13	12:00:40s -0:00:40 -
XRule	sol87	1987	only	-	Apr	14	12:00:25s -0:00:25 -
XRule	sol87	1987	only	-	Apr	15	12:00:10s -0:00:10 -
XRule	sol87	1987	only	-	Apr	16	11:59:55s 0:00:05 -
XRule	sol87	1987	only	-	Apr	17	11:59:45s 0:00:15 -
XRule	sol87	1987	only	-	Apr	18	11:59:30s 0:00:30 -
XRule	sol87	1987	only	-	Apr	19	11:59:15s 0:00:45 -
XRule	sol87	1987	only	-	Apr	20	11:59:05s 0:00:55 -
XRule	sol87	1987	only	-	Apr	21	11:58:50s 0:01:10 -
XRule	sol87	1987	only	-	Apr	22	11:58:40s 0:01:20 -
XRule	sol87	1987	only	-	Apr	23	11:58:25s 0:01:35 -
XRule	sol87	1987	only	-	Apr	24	11:58:15s 0:01:45 -
XRule	sol87	1987	only	-	Apr	25	11:58:05s 0:01:55 -
XRule	sol87	1987	only	-	Apr	26	11:57:55s 0:02:05 -
XRule	sol87	1987	only	-	Apr	27	11:57:45s 0:02:15 -
XRule	sol87	1987	only	-	Apr	28	11:57:35s 0:02:25 -
XRule	sol87	1987	only	-	Apr	29	11:57:25s 0:02:35 -
XRule	sol87	1987	only	-	Apr	30	11:57:15s 0:02:45 -
XRule	sol87	1987	only	-	May	1	11:57:10s 0:02:50 -
XRule	sol87	1987	only	-	May	2	11:57:00s 0:03:00 -
XRule	sol87	1987	only	-	May	3	11:56:55s 0:03:05 -
XRule	sol87	1987	only	-	May	4	11:56:50s 0:03:10 -
XRule	sol87	1987	only	-	May	5	11:56:45s 0:03:15 -
XRule	sol87	1987	only	-	May	6	11:56:40s 0:03:20 -
XRule	sol87	1987	only	-	May	7	11:56:35s 0:03:25 -
XRule	sol87	1987	only	-	May	8	11:56:30s 0:03:30 -
XRule	sol87	1987	only	-	May	9	11:56:25s 0:03:35 -
XRule	sol87	1987	only	-	May	10	11:56:25s 0:03:35 -
XRule	sol87	1987	only	-	May	11	11:56:20s 0:03:40 -
XRule	sol87	1987	only	-	May	12	11:56:20s 0:03:40 -
XRule	sol87	1987	only	-	May	13	11:56:20s 0:03:40 -
XRule	sol87	1987	only	-	May	14	11:56:20s 0:03:40 -
XRule	sol87	1987	only	-	May	15	11:56:20s 0:03:40 -
XRule	sol87	1987	only	-	May	16	11:56:20s 0:03:40 -
XRule	sol87	1987	only	-	May	17	11:56:20s 0:03:40 -
XRule	sol87	1987	only	-	May	18	11:56:20s 0:03:40 -
XRule	sol87	1987	only	-	May	19	11:56:25s 0:03:35 -
XRule	sol87	1987	only	-	May	20	11:56:25s 0:03:35 -
XRule	sol87	1987	only	-	May	21	11:56:30s 0:03:30 -
XRule	sol87	1987	only	-	May	22	11:56:35s 0:03:25 -
XRule	sol87	1987	only	-	May	23	11:56:40s 0:03:20 -
XRule	sol87	1987	only	-	May	24	11:56:45s 0:03:15 -
XRule	sol87	1987	only	-	May	25	11:56:50s 0:03:10 -
XRule	sol87	1987	only	-	May	26	11:56:55s 0:03:05 -
XRule	sol87	1987	only	-	May	27	11:57:00s 0:03:00 -
XRule	sol87	1987	only	-	May	28	11:57:10s 0:02:50 -
XRule	sol87	1987	only	-	May	29	11:57:15s 0:02:45 -
XRule	sol87	1987	only	-	May	30	11:57:25s 0:02:35 -
XRule	sol87	1987	only	-	May	31	11:57:30s 0:02:30 -
XRule	sol87	1987	only	-	Jun	1	11:57:40s 0:02:20 -
XRule	sol87	1987	only	-	Jun	2	11:57:50s 0:02:10 -
XRule	sol87	1987	only	-	Jun	3	11:58:00s 0:02:00 -
XRule	sol87	1987	only	-	Jun	4	11:58:10s 0:01:50 -
XRule	sol87	1987	only	-	Jun	5	11:58:20s 0:01:40 -
XRule	sol87	1987	only	-	Jun	6	11:58:30s 0:01:30 -
XRule	sol87	1987	only	-	Jun	7	11:58:40s 0:01:20 -
XRule	sol87	1987	only	-	Jun	8	11:58:50s 0:01:10 -
XRule	sol87	1987	only	-	Jun	9	11:59:05s 0:00:55 -
XRule	sol87	1987	only	-	Jun	10	11:59:15s 0:00:45 -
XRule	sol87	1987	only	-	Jun	11	11:59:30s 0:00:30 -
XRule	sol87	1987	only	-	Jun	12	11:59:40s 0:00:20 -
XRule	sol87	1987	only	-	Jun	13	11:59:50s 0:00:10 -
XRule	sol87	1987	only	-	Jun	14	12:00:05s -0:00:05 -
XRule	sol87	1987	only	-	Jun	15	12:00:15s -0:00:15 -
XRule	sol87	1987	only	-	Jun	16	12:00:30s -0:00:30 -
XRule	sol87	1987	only	-	Jun	17	12:00:45s -0:00:45 -
XRule	sol87	1987	only	-	Jun	18	12:00:55s -0:00:55 -
XRule	sol87	1987	only	-	Jun	19	12:01:10s -0:01:10 -
XRule	sol87	1987	only	-	Jun	20	12:01:20s -0:01:20 -
XRule	sol87	1987	only	-	Jun	21	12:01:35s -0:01:35 -
XRule	sol87	1987	only	-	Jun	22	12:01:50s -0:01:50 -
XRule	sol87	1987	only	-	Jun	23	12:02:00s -0:02:00 -
XRule	sol87	1987	only	-	Jun	24	12:02:15s -0:02:15 -
XRule	sol87	1987	only	-	Jun	25	12:02:25s -0:02:25 -
XRule	sol87	1987	only	-	Jun	26	12:02:40s -0:02:40 -
XRule	sol87	1987	only	-	Jun	27	12:02:50s -0:02:50 -
XRule	sol87	1987	only	-	Jun	28	12:03:05s -0:03:05 -
XRule	sol87	1987	only	-	Jun	29	12:03:15s -0:03:15 -
XRule	sol87	1987	only	-	Jun	30	12:03:30s -0:03:30 -
XRule	sol87	1987	only	-	Jul	1	12:03:40s -0:03:40 -
XRule	sol87	1987	only	-	Jul	2	12:03:50s -0:03:50 -
XRule	sol87	1987	only	-	Jul	3	12:04:05s -0:04:05 -
XRule	sol87	1987	only	-	Jul	4	12:04:15s -0:04:15 -
XRule	sol87	1987	only	-	Jul	5	12:04:25s -0:04:25 -
XRule	sol87	1987	only	-	Jul	6	12:04:35s -0:04:35 -
XRule	sol87	1987	only	-	Jul	7	12:04:45s -0:04:45 -
XRule	sol87	1987	only	-	Jul	8	12:04:55s -0:04:55 -
XRule	sol87	1987	only	-	Jul	9	12:05:05s -0:05:05 -
XRule	sol87	1987	only	-	Jul	10	12:05:15s -0:05:15 -
XRule	sol87	1987	only	-	Jul	11	12:05:20s -0:05:20 -
XRule	sol87	1987	only	-	Jul	12	12:05:30s -0:05:30 -
XRule	sol87	1987	only	-	Jul	13	12:05:40s -0:05:40 -
XRule	sol87	1987	only	-	Jul	14	12:05:45s -0:05:45 -
XRule	sol87	1987	only	-	Jul	15	12:05:50s -0:05:50 -
XRule	sol87	1987	only	-	Jul	16	12:06:00s -0:06:00 -
XRule	sol87	1987	only	-	Jul	17	12:06:05s -0:06:05 -
XRule	sol87	1987	only	-	Jul	18	12:06:10s -0:06:10 -
XRule	sol87	1987	only	-	Jul	19	12:06:15s -0:06:15 -
XRule	sol87	1987	only	-	Jul	20	12:06:15s -0:06:15 -
XRule	sol87	1987	only	-	Jul	21	12:06:20s -0:06:20 -
XRule	sol87	1987	only	-	Jul	22	12:06:25s -0:06:25 -
XRule	sol87	1987	only	-	Jul	23	12:06:25s -0:06:25 -
XRule	sol87	1987	only	-	Jul	24	12:06:25s -0:06:25 -
XRule	sol87	1987	only	-	Jul	25	12:06:30s -0:06:30 -
XRule	sol87	1987	only	-	Jul	26	12:06:30s -0:06:30 -
XRule	sol87	1987	only	-	Jul	27	12:06:30s -0:06:30 -
XRule	sol87	1987	only	-	Jul	28	12:06:30s -0:06:30 -
XRule	sol87	1987	only	-	Jul	29	12:06:25s -0:06:25 -
XRule	sol87	1987	only	-	Jul	30	12:06:25s -0:06:25 -
XRule	sol87	1987	only	-	Jul	31	12:06:25s -0:06:25 -
XRule	sol87	1987	only	-	Aug	1	12:06:20s -0:06:20 -
XRule	sol87	1987	only	-	Aug	2	12:06:15s -0:06:15 -
XRule	sol87	1987	only	-	Aug	3	12:06:10s -0:06:10 -
XRule	sol87	1987	only	-	Aug	4	12:06:05s -0:06:05 -
XRule	sol87	1987	only	-	Aug	5	12:06:00s -0:06:00 -
XRule	sol87	1987	only	-	Aug	6	12:05:55s -0:05:55 -
XRule	sol87	1987	only	-	Aug	7	12:05:50s -0:05:50 -
XRule	sol87	1987	only	-	Aug	8	12:05:40s -0:05:40 -
XRule	sol87	1987	only	-	Aug	9	12:05:35s -0:05:35 -
XRule	sol87	1987	only	-	Aug	10	12:05:25s -0:05:25 -
XRule	sol87	1987	only	-	Aug	11	12:05:15s -0:05:15 -
XRule	sol87	1987	only	-	Aug	12	12:05:05s -0:05:05 -
XRule	sol87	1987	only	-	Aug	13	12:04:55s -0:04:55 -
XRule	sol87	1987	only	-	Aug	14	12:04:45s -0:04:45 -
XRule	sol87	1987	only	-	Aug	15	12:04:35s -0:04:35 -
XRule	sol87	1987	only	-	Aug	16	12:04:25s -0:04:25 -
XRule	sol87	1987	only	-	Aug	17	12:04:10s -0:04:10 -
XRule	sol87	1987	only	-	Aug	18	12:04:00s -0:04:00 -
XRule	sol87	1987	only	-	Aug	19	12:03:45s -0:03:45 -
XRule	sol87	1987	only	-	Aug	20	12:03:30s -0:03:30 -
XRule	sol87	1987	only	-	Aug	21	12:03:15s -0:03:15 -
XRule	sol87	1987	only	-	Aug	22	12:03:00s -0:03:00 -
XRule	sol87	1987	only	-	Aug	23	12:02:45s -0:02:45 -
XRule	sol87	1987	only	-	Aug	24	12:02:30s -0:02:30 -
XRule	sol87	1987	only	-	Aug	25	12:02:15s -0:02:15 -
XRule	sol87	1987	only	-	Aug	26	12:02:00s -0:02:00 -
XRule	sol87	1987	only	-	Aug	27	12:01:40s -0:01:40 -
XRule	sol87	1987	only	-	Aug	28	12:01:25s -0:01:25 -
XRule	sol87	1987	only	-	Aug	29	12:01:05s -0:01:05 -
XRule	sol87	1987	only	-	Aug	30	12:00:50s -0:00:50 -
XRule	sol87	1987	only	-	Aug	31	12:00:30s -0:00:30 -
XRule	sol87	1987	only	-	Sep	1	12:00:10s -0:00:10 -
XRule	sol87	1987	only	-	Sep	2	11:59:50s 0:00:10 -
XRule	sol87	1987	only	-	Sep	3	11:59:35s 0:00:25 -
XRule	sol87	1987	only	-	Sep	4	11:59:15s 0:00:45 -
XRule	sol87	1987	only	-	Sep	5	11:58:55s 0:01:05 -
XRule	sol87	1987	only	-	Sep	6	11:58:35s 0:01:25 -
XRule	sol87	1987	only	-	Sep	7	11:58:15s 0:01:45 -
XRule	sol87	1987	only	-	Sep	8	11:57:55s 0:02:05 -
XRule	sol87	1987	only	-	Sep	9	11:57:30s 0:02:30 -
XRule	sol87	1987	only	-	Sep	10	11:57:10s 0:02:50 -
XRule	sol87	1987	only	-	Sep	11	11:56:50s 0:03:10 -
XRule	sol87	1987	only	-	Sep	12	11:56:30s 0:03:30 -
XRule	sol87	1987	only	-	Sep	13	11:56:10s 0:03:50 -
XRule	sol87	1987	only	-	Sep	14	11:55:45s 0:04:15 -
XRule	sol87	1987	only	-	Sep	15	11:55:25s 0:04:35 -
XRule	sol87	1987	only	-	Sep	16	11:55:05s 0:04:55 -
XRule	sol87	1987	only	-	Sep	17	11:54:45s 0:05:15 -
XRule	sol87	1987	only	-	Sep	18	11:54:20s 0:05:40 -
XRule	sol87	1987	only	-	Sep	19	11:54:00s 0:06:00 -
XRule	sol87	1987	only	-	Sep	20	11:53:40s 0:06:20 -
XRule	sol87	1987	only	-	Sep	21	11:53:15s 0:06:45 -
XRule	sol87	1987	only	-	Sep	22	11:52:55s 0:07:05 -
XRule	sol87	1987	only	-	Sep	23	11:52:35s 0:07:25 -
XRule	sol87	1987	only	-	Sep	24	11:52:15s 0:07:45 -
XRule	sol87	1987	only	-	Sep	25	11:51:55s 0:08:05 -
XRule	sol87	1987	only	-	Sep	26	11:51:35s 0:08:25 -
XRule	sol87	1987	only	-	Sep	27	11:51:10s 0:08:50 -
XRule	sol87	1987	only	-	Sep	28	11:50:50s 0:09:10 -
XRule	sol87	1987	only	-	Sep	29	11:50:30s 0:09:30 -
XRule	sol87	1987	only	-	Sep	30	11:50:10s 0:09:50 -
XRule	sol87	1987	only	-	Oct	1	11:49:50s 0:10:10 -
XRule	sol87	1987	only	-	Oct	2	11:49:35s 0:10:25 -
XRule	sol87	1987	only	-	Oct	3	11:49:15s 0:10:45 -
XRule	sol87	1987	only	-	Oct	4	11:48:55s 0:11:05 -
XRule	sol87	1987	only	-	Oct	5	11:48:35s 0:11:25 -
XRule	sol87	1987	only	-	Oct	6	11:48:20s 0:11:40 -
XRule	sol87	1987	only	-	Oct	7	11:48:00s 0:12:00 -
XRule	sol87	1987	only	-	Oct	8	11:47:45s 0:12:15 -
XRule	sol87	1987	only	-	Oct	9	11:47:25s 0:12:35 -
XRule	sol87	1987	only	-	Oct	10	11:47:10s 0:12:50 -
XRule	sol87	1987	only	-	Oct	11	11:46:55s 0:13:05 -
XRule	sol87	1987	only	-	Oct	12	11:46:40s 0:13:20 -
XRule	sol87	1987	only	-	Oct	13	11:46:25s 0:13:35 -
XRule	sol87	1987	only	-	Oct	14	11:46:10s 0:13:50 -
XRule	sol87	1987	only	-	Oct	15	11:45:55s 0:14:05 -
XRule	sol87	1987	only	-	Oct	16	11:45:45s 0:14:15 -
XRule	sol87	1987	only	-	Oct	17	11:45:30s 0:14:30 -
XRule	sol87	1987	only	-	Oct	18	11:45:20s 0:14:40 -
XRule	sol87	1987	only	-	Oct	19	11:45:05s 0:14:55 -
XRule	sol87	1987	only	-	Oct	20	11:44:55s 0:15:05 -
XRule	sol87	1987	only	-	Oct	21	11:44:45s 0:15:15 -
XRule	sol87	1987	only	-	Oct	22	11:44:35s 0:15:25 -
XRule	sol87	1987	only	-	Oct	23	11:44:25s 0:15:35 -
XRule	sol87	1987	only	-	Oct	24	11:44:20s 0:15:40 -
XRule	sol87	1987	only	-	Oct	25	11:44:10s 0:15:50 -
XRule	sol87	1987	only	-	Oct	26	11:44:05s 0:15:55 -
XRule	sol87	1987	only	-	Oct	27	11:43:55s 0:16:05 -
XRule	sol87	1987	only	-	Oct	28	11:43:50s 0:16:10 -
XRule	sol87	1987	only	-	Oct	29	11:43:45s 0:16:15 -
XRule	sol87	1987	only	-	Oct	30	11:43:45s 0:16:15 -
XRule	sol87	1987	only	-	Oct	31	11:43:40s 0:16:20 -
XRule	sol87	1987	only	-	Nov	1	11:43:40s 0:16:20 -
XRule	sol87	1987	only	-	Nov	2	11:43:35s 0:16:25 -
XRule	sol87	1987	only	-	Nov	3	11:43:35s 0:16:25 -
XRule	sol87	1987	only	-	Nov	4	11:43:35s 0:16:25 -
XRule	sol87	1987	only	-	Nov	5	11:43:35s 0:16:25 -
XRule	sol87	1987	only	-	Nov	6	11:43:40s 0:16:20 -
XRule	sol87	1987	only	-	Nov	7	11:43:40s 0:16:20 -
XRule	sol87	1987	only	-	Nov	8	11:43:45s 0:16:15 -
XRule	sol87	1987	only	-	Nov	9	11:43:50s 0:16:10 -
XRule	sol87	1987	only	-	Nov	10	11:43:55s 0:16:05 -
XRule	sol87	1987	only	-	Nov	11	11:44:00s 0:16:00 -
XRule	sol87	1987	only	-	Nov	12	11:44:05s 0:15:55 -
XRule	sol87	1987	only	-	Nov	13	11:44:15s 0:15:45 -
XRule	sol87	1987	only	-	Nov	14	11:44:20s 0:15:40 -
XRule	sol87	1987	only	-	Nov	15	11:44:30s 0:15:30 -
XRule	sol87	1987	only	-	Nov	16	11:44:40s 0:15:20 -
XRule	sol87	1987	only	-	Nov	17	11:44:50s 0:15:10 -
XRule	sol87	1987	only	-	Nov	18	11:45:05s 0:14:55 -
XRule	sol87	1987	only	-	Nov	19	11:45:15s 0:14:45 -
XRule	sol87	1987	only	-	Nov	20	11:45:30s 0:14:30 -
XRule	sol87	1987	only	-	Nov	21	11:45:45s 0:14:15 -
XRule	sol87	1987	only	-	Nov	22	11:46:00s 0:14:00 -
XRule	sol87	1987	only	-	Nov	23	11:46:15s 0:13:45 -
XRule	sol87	1987	only	-	Nov	24	11:46:30s 0:13:30 -
XRule	sol87	1987	only	-	Nov	25	11:46:50s 0:13:10 -
XRule	sol87	1987	only	-	Nov	26	11:47:10s 0:12:50 -
XRule	sol87	1987	only	-	Nov	27	11:47:25s 0:12:35 -
XRule	sol87	1987	only	-	Nov	28	11:47:45s 0:12:15 -
XRule	sol87	1987	only	-	Nov	29	11:48:05s 0:11:55 -
XRule	sol87	1987	only	-	Nov	30	11:48:30s 0:11:30 -
XRule	sol87	1987	only	-	Dec	1	11:48:50s 0:11:10 -
XRule	sol87	1987	only	-	Dec	2	11:49:10s 0:10:50 -
XRule	sol87	1987	only	-	Dec	3	11:49:35s 0:10:25 -
XRule	sol87	1987	only	-	Dec	4	11:50:00s 0:10:00 -
XRule	sol87	1987	only	-	Dec	5	11:50:25s 0:09:35 -
XRule	sol87	1987	only	-	Dec	6	11:50:50s 0:09:10 -
XRule	sol87	1987	only	-	Dec	7	11:51:15s 0:08:45 -
XRule	sol87	1987	only	-	Dec	8	11:51:40s 0:08:20 -
XRule	sol87	1987	only	-	Dec	9	11:52:05s 0:07:55 -
XRule	sol87	1987	only	-	Dec	10	11:52:30s 0:07:30 -
XRule	sol87	1987	only	-	Dec	11	11:53:00s 0:07:00 -
XRule	sol87	1987	only	-	Dec	12	11:53:25s 0:06:35 -
XRule	sol87	1987	only	-	Dec	13	11:53:55s 0:06:05 -
XRule	sol87	1987	only	-	Dec	14	11:54:25s 0:05:35 -
XRule	sol87	1987	only	-	Dec	15	11:54:50s 0:05:10 -
XRule	sol87	1987	only	-	Dec	16	11:55:20s 0:04:40 -
XRule	sol87	1987	only	-	Dec	17	11:55:50s 0:04:10 -
XRule	sol87	1987	only	-	Dec	18	11:56:20s 0:03:40 -
XRule	sol87	1987	only	-	Dec	19	11:56:50s 0:03:10 -
XRule	sol87	1987	only	-	Dec	20	11:57:20s 0:02:40 -
XRule	sol87	1987	only	-	Dec	21	11:57:50s 0:02:10 -
XRule	sol87	1987	only	-	Dec	22	11:58:20s 0:01:40 -
XRule	sol87	1987	only	-	Dec	23	11:58:50s 0:01:10 -
XRule	sol87	1987	only	-	Dec	24	11:59:20s 0:00:40 -
XRule	sol87	1987	only	-	Dec	25	11:59:50s 0:00:10 -
XRule	sol87	1987	only	-	Dec	26	12:00:20s -0:00:20 -
XRule	sol87	1987	only	-	Dec	27	12:00:45s -0:00:45 -
XRule	sol87	1987	only	-	Dec	28	12:01:15s -0:01:15 -
XRule	sol87	1987	only	-	Dec	29	12:01:45s -0:01:45 -
XRule	sol87	1987	only	-	Dec	30	12:02:15s -0:02:15 -
XRule	sol87	1987	only	-	Dec	31	12:02:45s -0:02:45 -
X
X# Riyadh is at about 46 degrees 46 minutes East:  3 hrs, 7 mins, 4 secs
X# Before and after 1987, we'll operate on local mean solar time.
X
X# Zone	NAME		GMTOFF	RULES/SAVE	FORMAT	[UNTIL]
XZone	Mideast/Riyadh	3:07:04	-		??	1987
X			3:07:04	sol87		??	1988
X			3:07:04	-		??
END-of-solar87
echo x - systemv
sed 's/^X//' >systemv << 'END-of-systemv'
X# @(#)systemv	3.1
X
X#
X# Old rules, should the need arise.
X# No attempt is made to handle Newfoundland, since it cannot be expressed
X# using the System V "TZ" scheme (half-hour offset), or anything outside
X# North America (no support for non-standard DST start/end dates), nor
X# the change in the DST rules in the US in 1987 (can't split between
X# Canada, with no changes, and the US)
X#
X
X# Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
XRule	SystemV	min	1973	-	Apr	lastSun	2:00	1:00	D
XRule	SystemV	min	1973	-	Oct	lastSun	2:00	0	S
XRule	SystemV	1974	only	-	Jan	6	2:00	1:00	D
XRule	SystemV	1974	only	-	Nov	lastSun	2:00	0	S
XRule	SystemV	1975	only	-	Feb	23	2:00	1:00	D
XRule	SystemV	1975	only	-	Oct	lastSun	2:00	0	S
XRule	SystemV	1976	max	-	Apr	lastSun	2:00	1:00	D
XRule	SystemV	1976	max	-	Oct	lastSun	2:00	0	S
X
X# Zone	NAME		GMTOFF	RULES/SAVE	FORMAT	[UNTIL]
XZone	SystemV/AST4ADT	-4:00	SystemV		A%sT
XZone	SystemV/EST5EDT	-5:00	SystemV		E%sT
XZone	SystemV/CST6CDT	-6:00	SystemV		C%sT
XZone	SystemV/MST7MDT	-7:00	SystemV		M%sT
XZone	SystemV/PST8PDT	-8:00	SystemV		P%sT
XZone	SystemV/YST9YDT	-9:00	SystemV		Y%sT
XZone	SystemV/AST4	-4:00	-		AST
XZone	SystemV/EST5	-5:00	-		EST
XZone	SystemV/CST6	-6:00	-		CST
XZone	SystemV/MST7	-7:00	-		MST
XZone	SystemV/PST8	-8:00	-		PST
XZone	SystemV/YST9	-9:00	-		YST
XZone	SystemV/HST10	-10:00	-		HST
END-of-systemv
exit