Compute time zone using strftime.

This commit is contained in:
rsc 2004-04-20 17:00:01 +00:00
parent 99c75f3c50
commit dddc2ed156

View file

@ -34,12 +34,11 @@ tm2Tm(struct tm *tm, Tm *bigtm)
bigtm->mon = tm->tm_mon; bigtm->mon = tm->tm_mon;
bigtm->year = tm->tm_year; bigtm->year = tm->tm_year;
bigtm->wday = tm->tm_wday; bigtm->wday = tm->tm_wday;
#ifdef _HAVETMZONE strftime(bigtm->zone, sizeof bigtm->zone, "%Z", tm);
strecpy(bigtm->zone, bigtm->zone+4, tm->tm_zone);
#endif
#ifdef _HAVETZOFF #ifdef _HAVETZOFF
bigtm->tzoff = tm->tm_gmtoff; bigtm->tzoff = tm->tm_gmtoff;
#endif #endif
if(bigtm->zone[0] == 0){ if(bigtm->zone[0] == 0){
s = getenv("TIMEZONE"); s = getenv("TIMEZONE");
if(s){ if(s){