summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adam@chlipala.net>2010-12-29 16:16:25 -0500
committerGravatar Adam Chlipala <adam@chlipala.net>2010-12-29 16:16:25 -0500
commit62ffd600314eeb5f809728eff128346b1252adef (patch)
tree16207dfa629a75fdd23efc7f154b20b025cc72e6
parent935aefb4ae2a0448e5fb338df2e166025e3df2ed (diff)
Don't forget to call tzset()
-rw-r--r--src/c/urweb.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/c/urweb.c b/src/c/urweb.c
index 880666d8..6ddd6271 100644
--- a/src/c/urweb.c
+++ b/src/c/urweb.c
@@ -3675,10 +3675,14 @@ uw_Basis_bool uw_Basis_le_time(uw_context ctx, uw_Basis_time t1, uw_Basis_time t
uw_Basis_time *uw_Basis_readUtc(uw_context ctx, uw_Basis_string s) {
struct tm stm = {};
+ char *end = strchr(s, 0);
- if (strptime(s, TIME_FMT_PG, &stm) || strptime(s, TIME_FMT, &stm)) {
+ if (strptime(s, TIME_FMT_PG, &stm) == end || strptime(s, TIME_FMT, &stm) == end) {
uw_Basis_time *r = uw_malloc(ctx, sizeof(uw_Basis_time));
+
+ tzset();
stm.tm_hour -= timezone / (60 * 60);
+
r->seconds = mktime(&stm);
r->microseconds = 0;