The basic challenge with places such as Stanley (where a time-zone shift and a DST change were done at the same instant in 1985, resulting in no change of wall clock time) is that there's an hour when such a place is neither fish nor fowl. Here's a table summarizing what's happening on September 14/15 1995 in five different circumstances; each row of the table gives data for a particular instant in time. The circumstances: 1. What's happening in places that run on GMT 2. What's happening in (hypothetical) places that always run on EST/EDT using Falkland rules 3. What's happening in (hypothetical) places that always run on AST/ADT using Falkland rules 4. What zdump tells us is currently produced by zic for Stanley 5. And what we (presumably) really want for Stanley. =============================================================================== GMT-------|Always-ExT-----|Always-AxT-----|Stanley (now)--|Stanley (wanted) 15 2:59:59|14 23:59:59 EST|14 22:59:59 AST|14 23:59:59 EST|14 23:59:59 EST 15 3:00:00|15 01:00:00 EDT|14 23:00:00 AST|14 23:00:00 AST|15 00:00:00 ADT/EST 15 3:59:59|15 01:59:59 EDT|14 23:59:59 AST|14 23:59:59 AST|15 00:59:59 ADT/EST 15 4:00:00|15 02:00:00 EDT|15 01:00:00 ADT|15 01:00:00 ADT|15 01:00:00 ADT =============================================================================== The "Stanley (wanted)" stuff matches neither the "Always ExT" stuff nor the "Always AxT" stuff (regardless of whether you pick ADT or EST for Stanley to use as a time zone abbreviation during the strange hour). Among the ways to get from "Stanley (now)" to "Stanley (wanted)": 1. Hard code the transition hour--that is, where there are now lines that read... Zone Atlantic/Stanley -3:51:24 - LMT 1890 -3:51 - SMT 1912 Mar 12 -4:00 Falk A%sT 1983 May -3:00 Falk E%sT 1985 Sep 15 -4:00 Falk A%sT ...add a line to cover the hour in 1985... Zone Atlantic/Stanley -3:51:24 - LMT 1890 -3:51 - SMT 1912 Mar 12 -4:00 Falk A%sT 1983 May -3:00 Falk E%sT 1985 Sep 15 -3:00 - EST 1985 Sep 15 1:00 # <<<< -4:00 Falk A%sT 2. Set up zic to notice situations such as the above and "do the right thing." This would involve a code change something like this (with the "horrid special case" check perhaps made more strict): =============================================================================== SCCS/s.zic.c: 7.74 vs. 7.75 *** 7.74/zic.c Tue May 14 14:25:04 1996 --- 7.75/zic.c Tue May 14 14:25:06 1996 *************** *** 1,6 **** #ifndef lint #ifndef NOID ! static char elsieid[] = "@(#)zic.c 7.74"; #endif /* !defined NOID */ #endif /* !defined lint */ --- 1,6 ---- #ifndef lint #ifndef NOID ! static char elsieid[] = "@(#)zic.c 7.75"; #endif /* !defined NOID */ #endif /* !defined lint */ *************** *** 1397,1406 **** if (isdsts[0] == 0) while (attypes[fromi].type == 0) ++fromi; /* handled by default rule */ ! for ( ; fromi < timecnt; ++fromi) if (toi == 0 || attypes[toi - 1].type != attypes[fromi].type) attypes[toi++] = attypes[fromi]; timecnt = toi; } /* --- 1397,1414 ---- if (isdsts[0] == 0) while (attypes[fromi].type == 0) ++fromi; /* handled by default rule */ ! for ( ; fromi < timecnt; ++fromi) { ! /* ! ** Horrid special case. ! */ ! if ((fromi + 1) < timecnt && ! attypes[fromi + 1].at - attypes[fromi].at == ! SECSPERHOUR) ! continue; if (toi == 0 || attypes[toi - 1].type != attypes[fromi].type) attypes[toi++] = attypes[fromi]; + } timecnt = toi; } /* =============================================================================== I lean toward the second approach; are there any better ideas out there? --ado
Date: Tue, 14 May 96 14:31:50 EDT From: ado@elsie.nci.nih.gov (Arthur David Olson) I lean toward the second approach; are there any better ideas out there? How about the following implementation of the 2nd approach instead? It's the same basic idea, except that the two transitions are merged if their before-transition localtimes are the same (or if the latter precedes the former!). This should avoid the horridness of the 1-hour special case. This patch fixes bugs in the following transitions: 1919-03-01 Europe/Brussels 1973-04-29 America/Menominee 1983-10-30 America/Juneau 1985-04-19 Asia/Istanbul 1985-09-15 Atlantic/Stanley =================================================================== RCS file: RCS/zic.c,v retrieving revision 1996.6 retrieving revision 1996.6.1.2 diff -c -r1996.6 -r1996.6.1.2 *** zic.c 1996/05/03 02:49:23 1996.6 --- zic.c 1996/05/15 07:51:50 1996.6.1.2 *************** *** 1397,1406 **** if (isdsts[0] == 0) while (attypes[fromi].type == 0) ++fromi; /* handled by default rule */ ! for ( ; fromi < timecnt; ++fromi) if (toi == 0 || attypes[toi - 1].type != attypes[fromi].type) attypes[toi++] = attypes[fromi]; timecnt = toi; } /* --- 1397,1416 ---- if (isdsts[0] == 0) while (attypes[fromi].type == 0) ++fromi; /* handled by default rule */ ! for ( ; fromi < timecnt; ++fromi) { ! if (toi != 0 ! && ((attypes[fromi].at ! + gmtoffs[attypes[toi - 1].type]) ! <= (attypes[toi - 1].at ! + gmtoffs[toi == 1 ? 0 ! : attypes[toi - 2].type]))) { ! attypes[toi - 1].type = attypes[fromi].type; ! continue; ! } if (toi == 0 || attypes[toi - 1].type != attypes[fromi].type) attypes[toi++] = attypes[fromi]; + } timecnt = toi; } /*
participants (2)
-
ado -
Paul Eggert