# HG changeset patch # User Karn Kallio # Date 1302669281 16200 # Node ID 37599e85bba85a9a7e66a6e8e0ddc9e4355fe17b # Parent 17393c5e2b90bdfab82d7ebbad4b1a1e982000f1 Fix getting UTC time from formatted strings ( in uw_Basis_readUtc ). Corrects 2 things: - timezones with offsets not an integer number of hours - double correcting for daylight savings time diff -r 17393c5e2b90 -r 37599e85bba8 src/c/urweb.c --- a/src/c/urweb.c Sat Apr 09 20:00:52 2011 -0400 +++ b/src/c/urweb.c Wed Apr 13 00:04:41 2011 -0430 @@ -3763,23 +3763,13 @@ uw_Basis_time *uw_Basis_readUtc(uw_context ctx, uw_Basis_string s) { struct tm stm = {}; char *end = strchr(s, 0); - stm.tm_isdst = -1; 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->seconds = timegm(&stm); r->microseconds = 0; - localtime_r(&r->seconds, &stm); - if (stm.tm_isdst == 1) { - ++stm.tm_hour; - r->seconds = mktime(&stm); - } - return r; } else