Timezone errors in Cnews and newsclip getdate.y
Mats Ohrman
matoh at sssab.se
Thu Jan 11 06:56:11 AEST 1990
[This article is crossposted to news.software.b and comp.sources.bugs]
[[ I'm sorry if this has been detected before - my coverage of n.s.b
and c.s.b is not what it should be... ]]
The other day I was trying to use the 'getdate.y' that was supplied
with the (as far as I know) latest release of Cnews (13 nov) with one
of my own programs, and while debugging I noticed something funny.
Two letters from the same area and about the same time was reported to
differ ten hours in age. The difference was between those two was that
the first letter gave the timezone as "-0500 (EST)" and the other just
"EST".
Looking through getdate.y I noticed that all the timezones given were
reversed from the format specified in RFC #822, p 26. That is,
timezones west of Greenwich were not negative, but positive. When
used, however, the timezone was added to, not subtracted from, local
time. This makes "EST" give the correct time, but "-0500 (EST)" ten
hours wrong.
Not only were the timezones reversed, but also the entire Europe.
Eastern Europe had the same time difference as Britain, two hours
west of Western Europe.
Looking briefly through the sources of "newsclip", I noticed that
these errors seemed to be there too...
A diff between the original verison and my corrected one is attached
below.
______________________________________________________________________________
_ : matoh at sssab.se
/ Mats Ohrman, : {mcvax,munnari,uunet}!sunic!sssab!matoh
Scandinavian System Support AB, : Phone: Nat. 013-11 16 60
Box 535, S-581 06 Linkoping, Sweden : Int. +46 13 11 16 60
----- Cut here -------------------------------------------------------------
6c6,10
< /* @(#)getdate.y 2.13 9/16/86 */
---
> /* @(#)getdate.y 2.13 9/16/86 */
> /* _ */
> /* Timezone code corrected 10 Jan 1989: Mats Ohrman, */
> /* Scandinavian System Support AB */
> /* (matoh at sssab.se) */
131c135
< jdate += zone * 60L;
---
> jdate -= zone * 60L;
279,312c283,316
< {"a.m.", MERIDIAN, AM},
< {"am", MERIDIAN, AM},
< {"p.m.", MERIDIAN, PM},
< {"pm", MERIDIAN, PM},
< {"nst", ZONE, 3 HRS + HALFHR}, /* Newfoundland */
< {"n.s.t.", ZONE, 3 HRS + HALFHR},
< {"ast", ZONE, 4 HRS}, /* Atlantic */
< {"a.s.t.", ZONE, 4 HRS},
< {"adt", DAYZONE, 4 HRS},
< {"a.d.t.", DAYZONE, 4 HRS},
< {"est", ZONE, 5 HRS}, /* Eastern */
< {"e.s.t.", ZONE, 5 HRS},
< {"edt", DAYZONE, 5 HRS},
< {"e.d.t.", DAYZONE, 5 HRS},
< {"cst", ZONE, 6 HRS}, /* Central */
< {"c.s.t.", ZONE, 6 HRS},
< {"cdt", DAYZONE, 6 HRS},
< {"c.d.t.", DAYZONE, 6 HRS},
< {"mst", ZONE, 7 HRS}, /* Mountain */
< {"m.s.t.", ZONE, 7 HRS},
< {"mdt", DAYZONE, 7 HRS},
< {"m.d.t.", DAYZONE, 7 HRS},
< {"pst", ZONE, 8 HRS}, /* Pacific */
< {"p.s.t.", ZONE, 8 HRS},
< {"pdt", DAYZONE, 8 HRS},
< {"p.d.t.", DAYZONE, 8 HRS},
< {"yst", ZONE, 9 HRS}, /* Yukon */
< {"y.s.t.", ZONE, 9 HRS},
< {"ydt", DAYZONE, 9 HRS},
< {"y.d.t.", DAYZONE, 9 HRS},
< {"hst", ZONE, 10 HRS}, /* Hawaii */
< {"h.s.t.", ZONE, 10 HRS},
< {"hdt", DAYZONE, 10 HRS},
< {"h.d.t.", DAYZONE, 10 HRS},
---
> {"a.m.", MERIDIAN, AM},
> {"am", MERIDIAN, AM},
> {"p.m.", MERIDIAN, PM},
> {"pm", MERIDIAN, PM},
> {"nst", ZONE, -3 HRS + HALFHR}, /* Newfoundland */
> {"n.s.t.", ZONE, -3 HRS + HALFHR},
> {"ast", ZONE, -4 HRS}, /* Atlantic */
> {"a.s.t.", ZONE, -4 HRS},
> {"adt", DAYZONE, -4 HRS},
> {"a.d.t.", DAYZONE, -4 HRS},
> {"est", ZONE, -5 HRS}, /* Eastern */
> {"e.s.t.", ZONE, -5 HRS},
> {"edt", DAYZONE, -5 HRS},
> {"e.d.t.", DAYZONE, -5 HRS},
> {"cst", ZONE, -6 HRS}, /* Central */
> {"c.s.t.", ZONE, -6 HRS},
> {"cdt", DAYZONE, -6 HRS},
> {"c.d.t.", DAYZONE, -6 HRS},
> {"mst", ZONE, -7 HRS}, /* Mountain */
> {"m.s.t.", ZONE, -7 HRS},
> {"mdt", DAYZONE, -7 HRS},
> {"m.d.t.", DAYZONE, -7 HRS},
> {"pst", ZONE, -8 HRS}, /* Pacific */
> {"p.s.t.", ZONE, -8 HRS},
> {"pdt", DAYZONE, -8 HRS},
> {"p.d.t.", DAYZONE, -8 HRS},
> {"yst", ZONE, -9 HRS}, /* Yukon */
> {"y.s.t.", ZONE, -9 HRS},
> {"ydt", DAYZONE, -9 HRS},
> {"y.d.t.", DAYZONE, -9 HRS},
> {"hst", ZONE, -10 HRS}, /* Hawaii */
> {"h.s.t.", ZONE, -10 HRS},
> {"hdt", DAYZONE, -10 HRS},
> {"h.d.t.", DAYZONE, -10 HRS},
314,329c318,333
< {"gmt", ZONE, 0 HRS},
< {"g.m.t.", ZONE, 0 HRS},
< {"bst", DAYZONE, 0 HRS}, /* British Summer Time */
< {"b.s.t.", DAYZONE, 0 HRS},
< {"eet", ZONE, 0 HRS}, /* European Eastern Time */
< {"e.e.t.", ZONE, 0 HRS},
< {"eest", DAYZONE, 0 HRS}, /* European Eastern Summer Time */
< {"e.e.s.t.", DAYZONE, 0 HRS},
< {"met", ZONE, -1 HRS}, /* Middle European Time */
< {"m.e.t.", ZONE, -1 HRS},
< {"mest", DAYZONE, -1 HRS}, /* Middle European Summer Time */
< {"m.e.s.t.", DAYZONE, -1 HRS},
< {"wet", ZONE, -2 HRS }, /* Western European Time */
< {"w.e.t.", ZONE, -2 HRS },
< {"west", DAYZONE, -2 HRS}, /* Western European Summer Time */
< {"w.e.s.t.", DAYZONE, -2 HRS},
---
> {"gmt", ZONE, 0 HRS},
> {"g.m.t.", ZONE, 0 HRS},
> {"bst", DAYZONE, 0 HRS}, /* British Summer Time */
> {"b.s.t.", DAYZONE, 0 HRS},
> {"wet", ZONE, 0 HRS}, /* Western European Time */
> {"w.e.t.", ZONE, 0 HRS},
> {"west", DAYZONE, 0 HRS}, /* Western European Summer Time */
> {"w.e.s.t.", DAYZONE, 0 HRS},
> {"met", ZONE, 1 HRS}, /* Middle European Time */
> {"m.e.t.", ZONE, 1 HRS},
> {"mest", DAYZONE, 1 HRS}, /* Middle European Summer Time */
> {"m.e.s.t.", DAYZONE, 1 HRS},
> {"eet", ZONE, 2 HRS}, /* European Eastern Time */
> {"e.e.t.", ZONE, 2 HRS},
> {"eest", DAYZONE, 2 HRS}, /* European Eastern Summer Time */
> {"e.e.s.t.", DAYZONE, 2 HRS},
331,333c335,337
< {"jst", ZONE, -9 HRS}, /* Japan Standard Time */
< {"j.s.t.", ZONE, -9 HRS}, /* Japan Standard Time */
< /* No daylight savings time */
---
> {"jst", ZONE, 9 HRS}, /* Japan Standard Time */
> {"j.s.t.", ZONE, 9 HRS}, /* Japan Standard Time */
> /* No daylight savings time */
335,344c339,349
< {"aest", ZONE, -10 HRS}, /* Australian Eastern Time */
< {"a.e.s.t.", ZONE, -10 HRS},
< {"aesst", DAYZONE, -10 HRS}, /* Australian Eastern Summer Time */
< {"a.e.s.s.t.", DAYZONE, -10 HRS},
< {"acst", ZONE, -(9 HRS + HALFHR)}, /* Australian Central Time */
< {"a.c.s.t.", ZONE, -(9 HRS + HALFHR)},
< {"acsst", DAYZONE, -(9 HRS + HALFHR)}, /* Australian Central Summer */
< {"a.c.s.s.t.", DAYZONE, -(9 HRS + HALFHR)},
< {"awst", ZONE, -8 HRS}, /* Australian Western Time */
< {"a.w.s.t.", ZONE, -8 HRS}, /* (no daylight time there, I'm told */
---
> {"aest", ZONE, 10 HRS}, /* Australian Eastern Time */
> {"a.e.s.t.", ZONE, 10 HRS},
> {"aesst", DAYZONE, 10 HRS}, /* Australian Eastern Summer Time */
> {"a.e.s.s.t.",DAYZONE, 10 HRS},
> {"acst", ZONE, (9 HRS + HALFHR)}, /* Austr. Central Time */
> {"a.c.s.t.", ZONE, (9 HRS + HALFHR)},
> {"acsst", DAYZONE, (9 HRS + HALFHR)}, /* Austr. Central Summer */
> {"a.c.s.s.t.",DAYZONE, (9 HRS + HALFHR)},
> {"awst", ZONE, 8 HRS}, /* Australian Western Time */
> {"a.w.s.t.", ZONE, 8 HRS},
> /* (no daylight time there, I'm told */
384,407c389,412
< {"a", ZONE, 1 HRS},
< {"b", ZONE, 2 HRS},
< {"c", ZONE, 3 HRS},
< {"d", ZONE, 4 HRS},
< {"e", ZONE, 5 HRS},
< {"f", ZONE, 6 HRS},
< {"g", ZONE, 7 HRS},
< {"h", ZONE, 8 HRS},
< {"i", ZONE, 9 HRS},
< {"k", ZONE, 10 HRS},
< {"l", ZONE, 11 HRS},
< {"m", ZONE, 12 HRS},
< {"n", ZONE, -1 HRS},
< {"o", ZONE, -2 HRS},
< {"p", ZONE, -3 HRS},
< {"q", ZONE, -4 HRS},
< {"r", ZONE, -5 HRS},
< {"s", ZONE, -6 HRS},
< {"t", ZONE, -7 HRS},
< {"u", ZONE, -8 HRS},
< {"v", ZONE, -9 HRS},
< {"w", ZONE, -10 HRS},
< {"x", ZONE, -11 HRS},
< {"y", ZONE, -12 HRS},
---
> {"a", ZONE, -1 HRS},
> {"b", ZONE, -2 HRS},
> {"c", ZONE, -3 HRS},
> {"d", ZONE, -4 HRS},
> {"e", ZONE, -5 HRS},
> {"f", ZONE, -6 HRS},
> {"g", ZONE, -7 HRS},
> {"h", ZONE, -8 HRS},
> {"i", ZONE, -9 HRS},
> {"k", ZONE, -10 HRS},
> {"l", ZONE, -11 HRS},
> {"m", ZONE, -12 HRS},
> {"n", ZONE, 1 HRS},
> {"o", ZONE, 2 HRS},
> {"p", ZONE, 3 HRS},
> {"q", ZONE, 4 HRS},
> {"r", ZONE, 5 HRS},
> {"s", ZONE, 6 HRS},
> {"t", ZONE, 7 HRS},
> {"u", ZONE, 8 HRS},
> {"v", ZONE, 9 HRS},
> {"w", ZONE, 10 HRS},
> {"x", ZONE, 11 HRS},
> {"y", ZONE, 12 HRS},
More information about the Comp.sources.bugs
mailing list