Mercurial > urweb
comparison src/c/urweb.c @ 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 |
comparison
equal
deleted
inserted
replaced
1374:8cdd25f9cfd0 | 1375:f294173d87db |
---|---|
3673 return r; | 3673 return r; |
3674 }*/ | 3674 }*/ |
3675 | 3675 |
3676 uw_Basis_time *uw_Basis_readUtc(uw_context ctx, uw_Basis_string s) { | 3676 uw_Basis_time *uw_Basis_readUtc(uw_context ctx, uw_Basis_string s) { |
3677 struct tm stm = {}; | 3677 struct tm stm = {}; |
3678 | 3678 char *end = strchr(s, 0); |
3679 if (strptime(s, TIME_FMT_PG, &stm) || strptime(s, TIME_FMT, &stm)) { | 3679 |
3680 if (strptime(s, TIME_FMT_PG, &stm) == end || strptime(s, TIME_FMT, &stm) == end) { | |
3680 uw_Basis_time *r = uw_malloc(ctx, sizeof(uw_Basis_time)); | 3681 uw_Basis_time *r = uw_malloc(ctx, sizeof(uw_Basis_time)); |
3682 | |
3683 tzset(); | |
3681 stm.tm_hour -= timezone / (60 * 60); | 3684 stm.tm_hour -= timezone / (60 * 60); |
3685 | |
3682 r->seconds = mktime(&stm); | 3686 r->seconds = mktime(&stm); |
3683 r->microseconds = 0; | 3687 r->microseconds = 0; |
3684 | 3688 |
3685 return r; | 3689 return r; |
3686 } | 3690 } |