From: ceriel Date: Thu, 5 Feb 1987 21:04:40 +0000 (+0000) Subject: *** empty log message *** X-Git-Tag: release-5-5~4739 X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=775e473fb05783d6c9a001aacfb223f3f1cd7ce6;p=ack.git *** empty log message *** --- diff --git a/lang/cem/libcc/gen/localtime.c b/lang/cem/libcc/gen/localtime.c index b931ee3ff..b8e205ff4 100644 --- a/lang/cem/libcc/gen/localtime.c +++ b/lang/cem/libcc/gen/localtime.c @@ -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_ydaytm_yday==enddst && gmt->tm_hour<3))) { + /* it all happens between 2 and 3 */ cl += 1*60*60; gmt = gmtime(&cl); gmt->tm_isdst++; diff --git a/lang/cem/libcc/gen/tzset.c b/lang/cem/libcc/gen/tzset.c index 1f7a83b8b..4c74df8fd 100644 --- a/lang/cem/libcc/gen/tzset.c +++ b/lang/cem/libcc/gen/tzset.c @@ -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 }