aboutsummaryrefslogtreecommitdiff
path: root/src/lib9/date.c
diff options
context:
space:
mode:
authorrsc <devnull@localhost>2004-03-25 23:03:57 +0000
committerrsc <devnull@localhost>2004-03-25 23:03:57 +0000
commit8ad517944e46710ab832350c0dc3fc4e9239f7e2 (patch)
tree7b99a1833e1b303719c2aac75e3f7e82482b42ab /src/lib9/date.c
parentcb27443abf3d6af6ab52377c71c843e619928433 (diff)
downloadplan9port-8ad517944e46710ab832350c0dc3fc4e9239f7e2.tar.gz
plan9port-8ad517944e46710ab832350c0dc3fc4e9239f7e2.tar.bz2
plan9port-8ad517944e46710ab832350c0dc3fc4e9239f7e2.zip
Today's changes.
More changes.
Diffstat (limited to 'src/lib9/date.c')
-rw-r--r--src/lib9/date.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/lib9/date.c b/src/lib9/date.c
index 8ece0c68..8f852de2 100644
--- a/src/lib9/date.c
+++ b/src/lib9/date.c
@@ -1,6 +1,5 @@
-#include <stdlib.h> /* setenv etc. */
-
#include <u.h>
+#include <stdlib.h> /* setenv etc. */
#define NOPLAN9DEFINES
#include <libc.h>
#include <time.h>
@@ -25,6 +24,8 @@ static Tm bigtm;
static void
tm2Tm(struct tm *tm, Tm *bigtm)
{
+ char *s;
+
memset(bigtm, 0, sizeof *bigtm);
bigtm->sec = tm->tm_sec;
bigtm->min = tm->tm_min;
@@ -39,6 +40,13 @@ tm2Tm(struct tm *tm, Tm *bigtm)
#ifdef _HAVETZOFF
bigtm->tzoff = tm->tm_gmtoff;
#endif
+ if(bigtm->zone[0] == 0){
+ s = getenv("TIMEZONE");
+ if(s){
+ strecpy(bigtm->zone, bigtm->zone+4, tm->tm_zone);
+ free(s);
+ }
+ }
}
static void