plan9port

fork of plan9port with libvec, libstr and libsdb
Log | Files | Refs | README | LICENSE

commit dddc2ed156bd5a089b737d9abfd97820b4b0dc17
parent 99c75f3c503b7b3d667c251e90170bf7e10037ce
Author: rsc <devnull@localhost>
Date:   Tue, 20 Apr 2004 17:00:01 +0000

Compute time zone using strftime.

Diffstat:
Msrc/lib9/date.c | 5++---
1 file changed, 2 insertions(+), 3 deletions(-)

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