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
(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++;
#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()
{
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
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
}