Local time?

Katsuhiro Kondou kondou at nec.co.jp
Mon Jan 3 04:03:22 UTC 2000


In article <ylhfgw6qxk.fsf at windlord.stanford.edu>,
	Russ Allbery <rra at stanford.edu> wrote;

} You can switch from gmtime to localtime; just make sure to then add the
} zone information to the Date header.  Take a look at the code in

I have a patch for this and am thinking of incorporate
it into CURRENT tree by adding another key into
readers.conf.  Attached is the one I'm using.
-- 
Katsuhiro Kondou

--- nnrpd/post.c.orig	Mon Jan  3 12:52:40 2000
+++ nnrpd/post.c	Mon Jan  3 12:51:29 2000
@@ -323,6 +323,7 @@
 {
     static char		MONTHS[] = "JanFebMarAprMayJunJulAugSepOctNovDec";
     static char		datebuff[40];
+    static char		localdatebuff[40];
     static char		orgbuff[SMBUF];
     static char		linebuff[40];
     static char		tracebuff[SMBUF];
@@ -368,20 +369,29 @@
 	return Error;
     }
 
-    if ((gmt = gmtime(&Now.time)) == NULL)
+    if (HDR(_date) == NULL) {
+	static char WEEKS[] = "SunMonTueWedThuFriSat" ;
+	if ((gmt = localtime(&Now.time)) == NULL)
 	    return "Can't get the time";
-    (void)sprintf(datebuff, "%d %3.3s %d %02d:%02d:%02d GMT",
+	(void)snprintf(localdatebuff, sizeof(localdatebuff),
+		      "%3.3s, %d %3.3s %d %02d:%02d:%02d %+04.4d (%3.3s)",
+	    &WEEKS[3 * gmt->tm_wday],
 	    gmt->tm_mday, &MONTHS[3 * gmt->tm_mon], 1900 + gmt->tm_year,
-	    gmt->tm_hour, gmt->tm_min, gmt->tm_sec);
-
-    if (HDR(_date) == NULL)
-	HDR(_date) = datebuff;
-    else {
+	    gmt->tm_hour, gmt->tm_min, gmt->tm_sec,
+	    -timezone/36, tzname[0]);
+	HDR(_date) = localdatebuff;
+    } else {
 	if ((t = parsedate(HDR(_date), &Now)) == -1)
 	    return "Can't parse \"Date\" header";
 	if (t > Now.time + DATE_FUZZ)
 	    return "Article posted in the future";
     }
+
+    if ((gmt = gmtime(&Now.time)) == NULL)
+	    return "Can't get the time";
+    (void)sprintf(datebuff, "%d %3.3s %d %02d:%02d:%02d GMT",
+	    gmt->tm_mday, &MONTHS[3 * gmt->tm_mon], 1900 + gmt->tm_year,
+	    gmt->tm_hour, gmt->tm_min, gmt->tm_sec);
 
     /* Newsgroups are checked later. */
 



More information about the inn-workers mailing list