[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[leafnode-list] Re: Timestamp



Ron 'The InSaNe One' Rosson schrieb:

> 	Date: Tue, 26 Oct 1999 05:53:41 +1734300
> 
> If anyone has a unified diff that would give me a working leafnode I
> would be back in business..

I append one, you can switch the "#if 0" to "#if 1" and test which one
works better on your system (both _should_ work IMHO).
According to the GNU libc info file, the daylight variable can take any
non-zero value if we are in daylight savings time. The same info proposes
that GNU programs should use tm_gmtoff instead of timezone and daylight.
(And the conv struct was assigned but never used.)

Regards...
	Michael

--- miscutil.c.orig	Mon Jul 19 19:45:33 1999
+++ miscutil.c	Tue Oct 26 19:59:38 1999
@@ -433,8 +433,7 @@
     time_t now;
     struct tm gmt;
     struct tm local;
-    struct tm conv;
-    extern long int timezone ;
+    extern long int timezone;
     extern int daylight ;
     int    hours, mins;
 
@@ -442,22 +441,16 @@
     now = time(0);
     gmt	  = *(gmtime(&now));
     local = *(localtime(&now));
-    conv  = *(localtime(&now));
-
-    /* if GMT were local, what would it be? */
-    conv.tm_year = gmt.tm_year;
-    conv.tm_mon	 = gmt.tm_mon;
-    conv.tm_mday = gmt.tm_mday;
-    conv.tm_hour = gmt.tm_hour;
-    conv.tm_min	 = gmt.tm_min;
-    conv.tm_sec	 = gmt.tm_sec;
-    conv.tm_wday = gmt.tm_wday;
-    conv.tm_yday = gmt.tm_yday;
 
+#if 0
     /* this is empirical */
-    hours = -timezone/60/60+daylight;
+    hours = -timezone/60/60+(daylight?1:0); 
+    /* daylight could be non-zero, not necessarily 1*/    
     mins  = -timezone/60%60;
-
+#else
+    hours = local.tm_gmtoff/60/60;
+    mins  = local.tm_gmtoff/60%60;    
+#endif
     /* finally print the string */
     sprintf(date, "%3s, %d %3s %4d %02d:%02d:%02d %+03d%02d",
 	    days[local.tm_wday], local.tm_mday, months[local.tm_mon],

-- 
leafnode-list@xxxxxxxxxxxxxxxxxxxxxxxxxxxx -- mailing list for leafnode
To unsubscribe, send mail with "unsubscribe" in the subject to the list