*** empty log message ***
This commit is contained in:
parent
c6a224a6d1
commit
775e473fb0
|
@ -25,13 +25,13 @@ localtime(clock)
|
||||||
register struct tm *gmt;
|
register struct tm *gmt;
|
||||||
long cl;
|
long cl;
|
||||||
int begindst, enddst;
|
int begindst, enddst;
|
||||||
extern int daylight;
|
extern int __daylight;
|
||||||
extern long timezone;
|
extern long __timezone;
|
||||||
|
|
||||||
tzset();
|
tzset();
|
||||||
cl = *clock - timezone;
|
cl = *clock - __timezone;
|
||||||
gmt = gmtime(&cl);
|
gmt = gmtime(&cl);
|
||||||
if (daylight) {
|
if (__daylight) {
|
||||||
/* daylight saving time.
|
/* daylight saving time.
|
||||||
Unfortunately, rules differ for different countries.
|
Unfortunately, rules differ for different countries.
|
||||||
Implemented here are heuristics that got it right
|
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==begindst && gmt->tm_hour>=2)) &&
|
||||||
(gmt->tm_yday<enddst ||
|
(gmt->tm_yday<enddst ||
|
||||||
(gmt->tm_yday==enddst && gmt->tm_hour<3))) {
|
(gmt->tm_yday==enddst && gmt->tm_hour<3))) {
|
||||||
|
/* it all happens between 2 and 3 */
|
||||||
cl += 1*60*60;
|
cl += 1*60*60;
|
||||||
gmt = gmtime(&cl);
|
gmt = gmtime(&cl);
|
||||||
gmt->tm_isdst++;
|
gmt->tm_isdst++;
|
||||||
|
|
|
@ -7,9 +7,15 @@
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef USG
|
||||||
long timezone = -1 * 60;
|
long timezone = -1 * 60;
|
||||||
int daylight = 1;
|
int daylight = 1;
|
||||||
char *tzname[] = {"MET", "MDT",};
|
char *tzname[] = {"MET", "MDT",};
|
||||||
|
#endif
|
||||||
|
|
||||||
|
long __timezone = -1 * 60;
|
||||||
|
int __daylight = 1;
|
||||||
|
char *__tzname[] = {"MET", "MDT", };
|
||||||
|
|
||||||
tzset()
|
tzset()
|
||||||
{
|
{
|
||||||
|
@ -18,15 +24,15 @@ tzset()
|
||||||
struct timezone tzon;
|
struct timezone tzon;
|
||||||
|
|
||||||
gettimeofday(&tval, &tzon);
|
gettimeofday(&tval, &tzon);
|
||||||
timezone = tzon.tz_minuteswest * 60L;
|
__timezone = tzon.tz_minuteswest * 60L;
|
||||||
daylight = tzon.tz_dsttime;
|
__daylight = tzon.tz_dsttime;
|
||||||
#else
|
#else
|
||||||
#ifndef USG
|
#ifndef USG
|
||||||
struct timeb time;
|
struct timeb time;
|
||||||
|
|
||||||
ftime(&time);
|
ftime(&time);
|
||||||
timezone = time.timezone*60L;
|
__timezone = time.timezone*60L;
|
||||||
daylight = time.dstflag;
|
__daylight = time.dstflag;
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -48,9 +54,15 @@ tzset()
|
||||||
while(*p >= '0' && *p <= '9')
|
while(*p >= '0' && *p <= '9')
|
||||||
n = 10 * n + (*p++ - '0');
|
n = 10 * n + (*p++ - '0');
|
||||||
n *= sign;
|
n *= sign;
|
||||||
timezone = ((long)(n * 60)) * 60;
|
__timezone = ((long)(n * 60)) * 60;
|
||||||
daylight = (*p != '\0');
|
__daylight = (*p != '\0');
|
||||||
strncpy(tzname[1], p, 3);
|
strncpy(tzname[1], p, 3);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#ifdef USG
|
||||||
|
timezone = __timezone;
|
||||||
|
daylight = __daylight;
|
||||||
|
tzname[0] = __tzname[0];
|
||||||
|
tzname[1] = __tzname[1];
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue