FW: tzcode2006a.tar.gz on Irix 6.5.18m
Andrew Donaldson is not on the time zone mailing list; direct replies appropriately. --ado -----Original Message----- From: Andrew Donaldson [mailto:A.Donaldson@bom.gov.au] Sent: Wednesday, February 01, 2006 10:48 PM To: tz@lecserver.nci.nih.gov Cc: Rob Petrini Subject: tzcode2006a.tar.gz on Irix 6.5.18m Dear Sir, We had just had reason to update some of our SGI machines' timezone data to reflect the changes in Melbourne, Australia due to the Commonwealth Games. Please note that we are hardly experts in this area, so we may have missed something obvious. We found that the zdump utility, used with the -v option, would only output the first times. $ ./zdump -v Australia/Melbourne Australia/Melbourne Thu Jan 1 00:00:00 1970 UTC = Thu Jan 1 10:00:00 1970 EST isdst=0 Australia/Melbourne Fri Jan 2 00:00:00 1970 UTC = Fri Jan 2 10:00:00 1970 EST isdst=0 Australia/Melbourne Tue Dec 30 23:59:59 1969 UTC = Wed Dec 31 09:59:59 1969 EST isdst=0 Australia/Melbourne Wed Dec 31 23:59:59 1969 UTC = Thu Jan 1 09:59:59 1970 EST isdst=0 After a bit of head scratching, we proved that the data files were valid, by viewing them on a linux computer, so we tried the source code from the classictzcode.tar.gz file which produced valid results both with the classictzdata.tar.gz and tzdata2006a.tar.gz data, the later including the updates to Melbourne time that we desired. I am unsure why the tzcode2006a.tar.gz version of zdump behaved differently. To compile tzcode2006a.tar.gz I had to make these changes: $ diff localtime.c localtime.c.orig 512d511 < /* 517,518d515 < */ < const char * getqzname P((const char * strp, const char delim)) To compile classictzcode.tar.gz I had to make these changes: $ diff zic.c zic.c.orig 64,65c64 < /*extern int getopt P((int argc, char * argv[], const char * options));*/ < extern int getopt P((int, char *const *, const char *)); ---
extern int getopt P((int argc, char * argv[], const char * options));
and $ diff getopt.c getopt.c.orig 52d51 < /* 57,58d55 < */ < int getopt(int nargc, char *const *nargv, const char *ostr) I hope our findings are useful to you. regards, Andrew Donaldson.
Andrew Donaldson writes:
We found that the zdump utility, used with the -v option, would only output the first times.
Thanks for reporting this. What options did you use to compile zdump? Did you compile it in 32- or 64-bit mode, for example?
I am unsure why the tzcode2006a.tar.gz version of zdump behaved differently.
Have you used other zdump.c versions besides tzclassic? If so, do you recall the most recent one that worked? Here are the recentish versions that I know about, along with their sizes (in bytes) and dates. 6302 Aug 26 1993 tz-1993d/zdump.c 6675 Oct 15 1993 tz-1993f/zdump.c 6673 Nov 22 1993 tz-1993g/zdump.c 6690 May 5 1994 tz-1994f/zdump.c 7252 Dec 8 1994 tz-1994h/zdump.c 7353 Mar 11 1995 tz-1995c/zdump.c 8135 Feb 21 1996 tz-1996e/zdump.c 8142 May 2 1996 tz-1996f/zdump.c 8155 Jan 20 1997 tz-1997a/zdump.c 8442 Mar 7 1997 tz-1997c/zdump.c 8442 Dec 29 1997 tz-1997i/zdump.c 8426 Jan 19 1999 tz-1999a/zdump.c 8420 Mar 13 2001 tz-2001a/zdump.c 8494 Sep 16 2003 tz-2003c/zdump.c 8494 Jul 19 2004 tz-2004b/zdump.c 9488 Aug 11 2004 tz-2004c/zdump.c 9495 Sep 6 2004 tz-2004d/zdump.c 10070 Oct 18 2004 tz-2004f/zdump.c 13542 Dec 30 2004 tz-2005a/zdump.c 14523 Jan 17 2005 tz-2005d/zdump.c 14517 Feb 7 2005 tz-2005e/zdump.c 14572 Apr 4 2005 tz-2005h/zdump.c 15557 Jul 14 2005 tz-2005j/zdump.c 15539 Aug 29 09:15 tz-2005m/zdump.c 15550 Nov 28 07:52 tz-2005o/zdump.c 15617 Dec 5 07:11 tz-2005p/zdump.c 15644 Dec 12 07:46 tz-2005q/zdump.c 15656 Dec 27 06:05 tz-2005r/zdump.c
To compile tzcode2006a.tar.gz I had to make these changes:
$ diff localtime.c localtime.c.orig 512d511 < /* 517,518d515 < */ < const char * getqzname P((const char * strp, const char delim))
I looked at that bit of code, and it's clear that zdump.c is violating that C Standard in this area, and it's conceivable that this might be causing your problem. The C Standard says that you cannot do something like this: /* forward declaration */ static void foo (char); /* implementation */ static void foo (c) char c; { } because the implementation relies on the argument being promoted to an integer, whereas the declaration says the argument is not promoted. getqzname violates this rule when __STDC__ is defined, with its 'char' argument. I found some other instances of this problem, with time_t rather than char; this is also an issue because time_t might be narrower than int (at least in theory -- the C Standard allows this and its examples take this possibility into account). The fix for this is to use ANSI-style prototypes for cases where this might arise. Here is a patch for this. This patch should be installed even if it doesn't fix your particular problem, since it does fix a standards violation. =================================================================== RCS file: RCS/date.c,v retrieving revision 2005.17 retrieving revision 2005.17.0.1 diff -pu -r2005.17 -r2005.17.0.1 --- date.c 2005/12/12 15:46:36 2005.17 +++ date.c 2006/02/02 20:47:49 2005.17.0.1 @@ -352,9 +352,13 @@ dogmt() /*ARGSUSED*/ static void +#ifdef __STDC__ +reset(const time_t newt, const int nflag) +#else reset(newt, nflag) const time_t newt; const int nflag; +#endif { register int fid; time_t oldt; @@ -619,10 +623,14 @@ register const struct tm * const btmp; #define ATOI2(ar) (ar[0] - '0') * 10 + (ar[1] - '0'); ar += 2; static time_t +#ifdef __STDC__ +convert(register const char * const value, const int dousg, const time_t t) +#else convert(value, dousg, t) register const char * const value; const int dousg; const time_t t; +#endif { register const char * cp; register const char * dotp; @@ -726,11 +734,18 @@ const time_t t; */ static void +#ifdef __STDC__ +checkfinal(const char * const value, + const int didusg, + const time_t t, + const time_t oldnow) +#else checkfinal(value, didusg, t, oldnow) const char * const value; const int didusg; const time_t t; const time_t oldnow; +#endif { time_t othert; struct tm tm; @@ -789,11 +804,16 @@ const time_t oldnow; } static void +#ifdef __STDC__ +iffy(const time_t thist, const time_t thatt, + const char * const value, const char * const reason) +#else iffy(thist, thatt, value, reason) const time_t thist; const time_t thatt; const char * const value; const char * const reason; +#endif { struct tm tm; =================================================================== RCS file: RCS/localtime.c,v retrieving revision 2005.17 retrieving revision 2005.17.0.1 diff -pu -r2005.17 -r2005.17.0.1 --- localtime.c 2005/12/08 16:35:40 2005.17 +++ localtime.c 2006/02/02 20:40:46 2005.17.0.1 @@ -510,9 +510,13 @@ register const char * strp; */ static const char * +#ifdef __STDC__ +getqzname(register const char *strp, const char delim) +#else getqzname(strp, delim) register const char * strp; const char delim; +#endif { register char c; =================================================================== RCS file: RCS/zdump.c,v retrieving revision 2005.18 retrieving revision 2005.18.0.1 diff -pu -r2005.18 -r2005.18.0.1 --- zdump.c 2005/12/27 14:05:26 2005.18 +++ zdump.c 2006/02/02 20:42:22 2005.18.0.1 @@ -468,10 +468,14 @@ const long y; } static time_t +#ifdef __STDC__ +hunt(char *name, time_t lot, time_t hit) +#else hunt(name, lot, hit) char * name; time_t lot; time_t hit; +#endif { time_t t; long diff; @@ -541,10 +545,14 @@ struct tm * oldp; } static void +#ifdef __STDC__ +show(char *zone, time_t t, int v) +#else show(zone, t, v) char * zone; time_t t; int v; +#endif { register struct tm * tmp;
participants (2)
-
Olson, Arthur David (NIH/NCI) [E] -
Paul Eggert