support for ICL extension to Posix TZ string parsing

Paul Eggert yata!eggert at twinsun.com
Sun May 8 19:33:49 UTC 1994


The following Usenet article describes a extension to Posix TZ strings
that allows the strings to express the daylight savings time rules
currently used in Britain.  At the end of this message is a patch to
the tz package that adds support for this extension.

This patch also fixes a theoretical leap second problem with Posix TZ
strings.  But looking at the code, I suspect that leap seconds don't
work at all with Posix TZ strings; perhaps this is intentional?

	Newsgroups: comp.unix.unixware
	From: jjf at dsbc.icl.co.uk (J J Farrell)
	Subject: Re: Daylight saving time in UW1.1
	Message-ID: <CpCvnG.7Dy at dsbc.icl.co.uk>
	Organization: International Computers Limited
	References: <767043120.AA04204 at cswamp.apana.org.au> <Cp9x6n.7uB at novell.co.uk>
	Date: Fri, 6 May 1994 00:50:03 GMT

	In article <Cp9x6n.7uB at novell.co.uk> msohnius at novell.co.uk
	(Martin Sohnius) writes:
	> UnixWare supports two different styles of timezone handling.
	>
	> One is what I may call "System V" style, with the TZ environment
	> variable as described in environ(5).

	It might be better described as "Standard" style - it's been specified
	by X/Open for many years, and I think Posix is the same.

	> Note also that the October rule for many parts of Australia
	> ("next-to-last Sunday in October") cannot be implemented with the
	> "System V" style TZ.  (NB nor can the British rule,
	> "day after 4th Saturday in October").

	I'm not sure about the Australian ones, but the British rule can be
	done in "System V" style TZ. The following works on SVR4 systems and
	has been issued by ICL for several years:

		GMT0BST,M3.5.0/1,M10.4.6/26

	I've not looked up the wording in the SVR4 documentation, but this does
	break the wording in XPG3; they may have loosened the wording in XPG4,
	but I haven't checked.

	It is probably a bug that this works, but bugs can sometimes be useful!

		My opinions; I do not speak for my employer.

===================================================================
RCS file: RCS/localtime.c,v
retrieving revision 1994.6.1.2
retrieving revision 1994.6.1.3
diff -c -r1994.6.1.2 -r1994.6.1.3
*** localtime.c	1994/05/09 10:16:11	1994.6.1.2
--- localtime.c	1994/05/09 10:22:51	1994.6.1.3
***************
*** 414,423 ****
  {
  	int	num;
  
! 	strp = getnum(strp, &num, 0, HOURSPERDAY);
  	if (strp == NULL)
  		return NULL;
! 	*secsp = num * SECSPERHOUR;
  	if (*strp == ':') {
  		++strp;
  		strp = getnum(strp, &num, 0, MINSPERHOUR - 1);
--- 414,429 ----
  {
  	int	num;
  
! 	/*
! 	** `HOURSPERDAY * DAYSPERWEEK - 1' allows quasi-Posix rules like
! 	** "M10.4.6/26", which does not conform to Posix,
! 	** but which specifies the equivalent of
! 	** ``02:00 on the first Sunday on or after 23 Oct''.
! 	*/
! 	strp = getnum(strp, &num, 0, HOURSPERDAY * DAYSPERWEEK - 1);
  	if (strp == NULL)
  		return NULL;
! 	*secsp = num * (long) SECSPERHOUR;
  	if (*strp == ':') {
  		++strp;
  		strp = getnum(strp, &num, 0, MINSPERHOUR - 1);
***************
*** 426,432 ****
  		*secsp += num * SECSPERMIN;
  		if (*strp == ':') {
  			++strp;
! 			strp = getnum(strp, &num, 0, SECSPERMIN - 1);
  			if (strp == NULL)
  				return NULL;
  			*secsp += num;
--- 432,439 ----
  		*secsp += num * SECSPERMIN;
  		if (*strp == ':') {
  			++strp;
! 			/* `SECSPERMIN' allows for leap seconds.  */
! 			strp = getnum(strp, &num, 0, SECSPERMIN);
  			if (strp == NULL)
  				return NULL;
  			*secsp += num;



More information about the tz mailing list