more time zone fixes
This commit is contained in:
parent
6452f95be6
commit
7f420fb373
1 changed files with 12 additions and 1 deletions
|
|
@ -12,12 +12,23 @@ static void
|
||||||
dotz(void)
|
dotz(void)
|
||||||
{
|
{
|
||||||
time_t t;
|
time_t t;
|
||||||
|
struct tm *gtm;
|
||||||
|
struct tm tm;
|
||||||
|
|
||||||
if(didtz)
|
if(didtz)
|
||||||
return;
|
return;
|
||||||
t = time(0);
|
t = time(0);
|
||||||
tzdelta = t - mktime(gmtime(&t));
|
|
||||||
strftime(tzone, sizeof tzone, "%Z", localtime(&t));
|
strftime(tzone, sizeof tzone, "%Z", localtime(&t));
|
||||||
|
tm = *localtime(&t); /* set local time zone field */
|
||||||
|
gtm = gmtime(&t);
|
||||||
|
tm.tm_sec = gtm->tm_sec;
|
||||||
|
tm.tm_min = gtm->tm_min;
|
||||||
|
tm.tm_hour = gtm->tm_hour;
|
||||||
|
tm.tm_mday = gtm->tm_mday;
|
||||||
|
tm.tm_mon = gtm->tm_mon;
|
||||||
|
tm.tm_year = gtm->tm_year;
|
||||||
|
tm.tm_wday = gtm->tm_wday;
|
||||||
|
tzdelta = t - mktime(&tm);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue