Article View: news.software.nn
Article #3016Re: messages not sorted correctly according to time
From: Paul Eggert
Date: Fri, 21 Aug 1992 20:22
Date: Fri, 21 Aug 1992 20:22
115 lines
4123 bytes
4123 bytes
NN mishandles non-GMT numeric time zones, and this often causes threads
to be mis-sorted. Here is a patch to NN 6.4.16 that fixes the problem.
This patch also fixes some other NN time bugs.
Unfortunately, this patch does not fix NN's mishandling of non-GMT time zones
near short month boundaries, but fixing this would be a bit tricky,
and luckily the bug is rare in real news.
===================================================================
RCS file: pack_date.c,v
retrieving revision 1.6
diff -c -r1.6 pack_date.c
*** pack_date.c 1991/04/17 08:32:40 1.6
--- pack_date.c 1991/06/07 21:51:24
***************
*** 4,9 ****
--- 4,11 ----
* Calculate an approximate "time_stamp" value for a date
* string. The actual value is not at all critical,
* as long as the "ordering" is ok.
+ * The current algorithm mishandles non-GMT time zones near
+ * short month boundaries, but this is rare in real news.
*
* The result is NOT a time_t value, i.e. ctime() will
* not produce the original Date string.
***************
*** 31,43 ****
int32 tz_offset;
} ztab[] = {
"a", UTC 1, /* UTC+1h */
- "acsst", 9 E 30 DST, /* Cent. Australia */
"acst", 9 E 30, /* Cent. Australia */
"adt", 4 W 0 DST, /* Atlantic (Canada) */
- "aesst", 10 E 0 DST, /* E. Australia */
"aest", 10 E 0, /* E. Australia */
"ast", 4 W 0, /* Atlantic (Canada) */
- "awsst", 8 E 0 DST, /* W. Australia */
"awst", 8 E 0, /* W. Australia */
"b", UTC 2, /* UTC+2h */
"bst", 0 E 0 DST, /* Great Britain summertime */
--- 33,42 ----
***************
*** 61,71 ****
--- 60,73 ----
"gmt", 0, /* */
"h", UTC 8, /* UTC+8h */
"hdt", 10 W 0 DST, /* Hawaii/Alaska */
+ "hkt", 8 E 0, /* Hong Kong */
"hst", 10 W 0, /* Hawaii/Alaska */
"i", UTC 9, /* UTC+9h */
"ist", 2 E 0, /* Israel */
"jst", 9 E 0, /* Japan */
"k", UTC 10, /* UTC+10h */
+ "kdt", 9 E 0 DST, /* Korea */
+ "kst", 9 E 0, /* Korea */
"l", UTC 11, /* UTC+11h */
"m", UTC 12, /* UTC+12h */
"mdt", 7 W 0 DST, /* Mountain US */
***************
*** 76,81 ****
--- 78,85 ----
"n", UTC -1, /* UTC-1h */
"ndt", 3 W 30 DST, /* Nfld. (Canada) */
"nst", 3 W 30, /* Nfld. (Canada) */
+ "nzdt", 12 E 0 DST, /* New Zealand */
+ "nzst", 12 E 0, /* New Zealand */
"o", UTC -2, /* UTC-2h */
"p", UTC -3, /* UTC-3h */
"pdt", 8 W 0 DST, /* Pacific */
***************
*** 165,179 ****
case 1: /* +H */
adjust += (num[0] - '0') * 60;
break;
- case 2: /* +HH */
- adjust = atoi(num) * 60;
- break;
default: /* +HHMM */
! if (num[2] != '0' || num[3] != '0') {
! num[4] = NUL;
! adjust = atoi(num + 2);
! }
num[2] = NUL;
adjust += atoi(num) * 60;
break;
}
--- 169,179 ----
case 1: /* +H */
adjust += (num[0] - '0') * 60;
break;
default: /* +HHMM */
! num[4] = NUL;
! adjust = atoi(num + 2);
num[2] = NUL;
+ case 2: /* +HH */
adjust += atoi(num) * 60;
break;
}
***************
*** 256,262 ****
res *= 24 * 60;
res += (hour * 60) + min;
! return res + tzone(date);
}
--- 256,262 ----
res *= 24 * 60;
res += (hour * 60) + min;
! return res - tzone(date);
}
Technical Details
Message-ID:
<bjn&Gvf&@twinsun.com>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!archive!mbox2nntp-news.software.nn.mbox.zip!sparky!uunet!paladin.american.edu!darwin.sura.net!mips!sdd.hp.com!elroy.jpl.nasa.gov!ucla-cs!twinsun!eggertReferences:
<1992Aug18.164442.18486@tfs.com>Show Full Headers
Complete Article Headers
Message-ID: <bjn&Gvf&@twinsun.com> Subject: Re: messages not sorted correctly according to time Date: Fri, 21 Aug 1992 20:22:33 GMT From: eggert@twinsun.com (Paul Eggert) References: <1992Aug18.164442.18486@tfs.com> Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!archive!mbox2nntp-news.software.nn.mbox.zip!sparky!uunet!paladin.american.edu!darwin.sura.net!mips!sdd.hp.com!elroy.jpl.nasa.gov!ucla-cs!twinsun!eggert Newsgroups: news.software.nn Sender: usenet@twinsun.com Nntp-Posting-Host: farside Organization: Twin Sun, Inc Lines: 115