changeset 1375:f294173d87db

Don't forget to call tzset()
author Adam Chlipala <adam@chlipala.net>
date Wed, 29 Dec 2010 16:16:25 -0500
parents 8cdd25f9cfd0
children a8ba2952b210
files src/c/urweb.c
diffstat 1 files changed, 6 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/c/urweb.c	Wed Dec 29 15:58:54 2010 -0500
+++ b/src/c/urweb.c	Wed Dec 29 16:16:25 2010 -0500
@@ -3675,10 +3675,14 @@
 
 uw_Basis_time *uw_Basis_readUtc(uw_context ctx, uw_Basis_string s) {
   struct tm stm = {};
-
-  if (strptime(s, TIME_FMT_PG, &stm) || strptime(s, TIME_FMT, &stm)) {
+  char *end = strchr(s, 0);
+
+  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;