summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/lib/embryo/embryo_time.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/lib/embryo/embryo_time.c b/src/lib/embryo/embryo_time.c
index e8b481e350..ce167cb4ff 100644
--- a/src/lib/embryo/embryo_time.c
+++ b/src/lib/embryo/embryo_time.c
@@ -107,7 +107,7 @@ _embryo_time_tzdate(Embryo_Program *ep, Embryo_Cell *params)
107 tzenv = getenv("TZ"); 107 tzenv = getenv("TZ");
108 if (tzenv) 108 if (tzenv)
109 strncpy(prevtz, tzenv, sizeof(prevtz) - 1); 109 strncpy(prevtz, tzenv, sizeof(prevtz) - 1);
110 if (tz) 110 if (tz && tz[0])
111 { 111 {
112 setenv("TZ", tz, 1); 112 setenv("TZ", tz, 1);
113 tzset(); 113 tzset();
@@ -115,11 +115,14 @@ _embryo_time_tzdate(Embryo_Program *ep, Embryo_Cell *params)
115 gettimeofday(&timev, NULL); 115 gettimeofday(&timev, NULL);
116 tt = (time_t)(timev.tv_sec); 116 tt = (time_t)(timev.tv_sec);
117 tm = localtime(&tt); 117 tm = localtime(&tt);
118 if (prevtz[0]) 118 if (tz && tz[0])
119 setenv("TZ", prevtz, 1); 119 {
120 else 120 if (prevtz[0])
121 unsetenv("TZ"); 121 setenv("TZ", prevtz, 1);
122 tzset(); 122 else
123 unsetenv("TZ");
124 tzset();
125 }
123 if (tm) 126 if (tm)
124 { 127 {
125 Embryo_Cell *cptr; 128 Embryo_Cell *cptr;