*** empty log message ***
authorceriel <none@none>
Thu, 5 Feb 1987 21:04:40 +0000 (21:04 +0000)
committerceriel <none@none>
Thu, 5 Feb 1987 21:04:40 +0000 (21:04 +0000)
lang/cem/libcc/gen/localtime.c
lang/cem/libcc/gen/tzset.c

index b931ee3..b8e205f 100644 (file)
@@ -25,13 +25,13 @@ localtime(clock)
        register struct tm *gmt;
        long cl;
        int begindst, enddst;
-       extern int daylight;
-       extern long timezone;
+       extern int __daylight;
+       extern long __timezone;
 
        tzset();
-       cl = *clock - timezone;
+       cl = *clock - __timezone;
        gmt = gmtime(&cl);
-       if (daylight) {
+       if (__daylight) {
                /* daylight saving time.
                   Unfortunately, rules differ for different countries.
                   Implemented here are heuristics that got it right
@@ -45,6 +45,7 @@ localtime(clock)
                     (gmt->tm_yday==begindst && gmt->tm_hour>=2)) &&
                    (gmt->tm_yday<enddst || 
                     (gmt->tm_yday==enddst && gmt->tm_hour<3))) {
+                       /* it all happens between 2 and 3 */
                        cl += 1*60*60;
                        gmt = gmtime(&cl);
                        gmt->tm_isdst++;
index 1f7a83b..4c74df8 100644 (file)
@@ -7,9 +7,15 @@
 #endif
 #endif
 
+#ifdef USG
 long   timezone = -1 * 60;
 int    daylight = 1;
 char   *tzname[] = {"MET", "MDT",};
+#endif
+
+long __timezone = -1 * 60;
+int __daylight = 1;
+char *__tzname[] = {"MET", "MDT", };
 
 tzset()
 {
@@ -18,15 +24,15 @@ tzset()
        struct timezone tzon;
 
        gettimeofday(&tval, &tzon);
-       timezone = tzon.tz_minuteswest * 60L;
-       daylight = tzon.tz_dsttime;
+       __timezone = tzon.tz_minuteswest * 60L;
+       __daylight = tzon.tz_dsttime;
 #else
 #ifndef USG
        struct timeb time;
 
        ftime(&time);
-       timezone = time.timezone*60L;
-       daylight = time.dstflag;
+       __timezone = time.timezone*60L;
+       __daylight = time.dstflag;
 #endif
 #endif
 
@@ -48,9 +54,15 @@ tzset()
                while(*p >= '0' && *p <= '9')
                        n = 10 * n + (*p++ - '0');
                n *= sign;
-               timezone = ((long)(n * 60)) * 60;
-               daylight = (*p != '\0');
+               __timezone = ((long)(n * 60)) * 60;
+               __daylight = (*p != '\0');
                strncpy(tzname[1], p, 3);
        }
        }
+#ifdef USG
+       timezone = __timezone;
+       daylight = __daylight;
+       tzname[0] = __tzname[0];
+       tzname[1] = __tzname[1];
+#endif
 }