[cvslog] (2004-10-18 05:39:44 UTC) Module eggdrop1.9: Change committed!

cvslog cvs at tsss.org
Sun Oct 17 23:39:44 CST 2004


CVSROOT    : /usr/local/cvsroot
Module     : eggdrop1.9
Commit time: 2004-10-18 05:39:44 UTC
Commited by: stdarg <stdarg at techmonkeys.org>

Modified files:
     lib/eggdrop/date.c lib/eggdrop/date.h

Log message:

* Alternate code to compute timezone.. hopefully more portable

---------------------- diff included ----------------------
Index: eggdrop1.9/lib/eggdrop/date.c
diff -u eggdrop1.9/lib/eggdrop/date.c:1.2 eggdrop1.9/lib/eggdrop/date.c:1.3
--- eggdrop1.9/lib/eggdrop/date.c:1.2	Sun Oct 17 00:44:13 2004
+++ eggdrop1.9/lib/eggdrop/date.c	Mon Oct 18 00:39:34 2004
@@ -386,10 +386,18 @@
 {
 }
 
-int date_timezone(time_t time)
+int date_timezone()
 {
-	localtime(0);
-	return(timezone/60);
+	struct tm gmt, local;
+	time_t now;
+	int zone;
+
+	time(&now);
+	gmt = *(gmtime(&now));
+	local = *(localtime(&now));
+	local.tm_isdst = gmt.tm_isdst = 0;
+	zone = (int)(mktime(&local) - mktime(&gmt));
+	return(zone/60);
 }
 
 static time_t
@@ -593,7 +601,7 @@
      */
 
     if (date_DateTimezone == 0) {
-        Julian += date_timezone((unsigned long) Start) * 60L;
+        Julian += date_timezone() * 60L;
     }
 
     /*
@@ -838,7 +846,7 @@
     int thisyear;
 
     /* Look up timezone if required. */
-    if (zone == EGG_TIMEZONE_LOOKUP) zone = date_timezone(0);
+    if (zone == EGG_TIMEZONE_LOOKUP) zone = date_timezone();
 
     date_DateInput = timestr;
     /* now has to be cast to a time_t for 64bit compliance */
Index: eggdrop1.9/lib/eggdrop/date.h
diff -u eggdrop1.9/lib/eggdrop/date.h:1.1 eggdrop1.9/lib/eggdrop/date.h:1.2
--- eggdrop1.9/lib/eggdrop/date.h:1.1	Sun Oct 17 00:14:06 2004
+++ eggdrop1.9/lib/eggdrop/date.h	Mon Oct 18 00:39:34 2004
@@ -3,7 +3,7 @@
 
 #define EGG_TIMEZONE_LOOKUP	-100000
 
-int date_timezone(time_t time);
+int date_timezone();
 int date_scan(char *timestr, time_t *now, int zone, time_t *timeptr);
 
 #endif
----------------------- End of diff -----------------------



More information about the Changes mailing list