comparison src/c/urweb.c @ 2015:4a93f379c452

Fix datetime construction (contributed by Patrick Hurst)
author Adam Chlipala <adam@chlipala.net>
date Sun, 18 May 2014 19:09:09 -0400
parents 77cc9169d6e0
children bcda3ae88677 c1a62ce47083
comparison
equal deleted inserted replaced
2014:fee1f660139c 2015:4a93f379c452
3999 return tm.seconds; 3999 return tm.seconds;
4000 } 4000 }
4001 4001
4002 uw_Basis_time uw_Basis_fromDatetime(uw_context ctx, uw_Basis_int year, uw_Basis_int month, uw_Basis_int day, uw_Basis_int hour, uw_Basis_int minute, uw_Basis_int second) { 4002 uw_Basis_time uw_Basis_fromDatetime(uw_context ctx, uw_Basis_int year, uw_Basis_int month, uw_Basis_int day, uw_Basis_int hour, uw_Basis_int minute, uw_Basis_int second) {
4003 struct tm tm = { .tm_year = year - 1900, .tm_mon = month, .tm_mday = day, 4003 struct tm tm = { .tm_year = year - 1900, .tm_mon = month, .tm_mday = day,
4004 .tm_hour = hour, .tm_min = minute, .tm_sec = second }; 4004 .tm_hour = hour, .tm_min = minute, .tm_sec = second,
4005 .tm_isdst = -1 };
4005 uw_Basis_time r = { timelocal(&tm) }; 4006 uw_Basis_time r = { timelocal(&tm) };
4006 return r; 4007 return r;
4007 } 4008 }
4008 4009
4009 uw_Basis_int uw_Basis_datetimeYear(uw_context ctx, uw_Basis_time time) { 4010 uw_Basis_int uw_Basis_datetimeYear(uw_context ctx, uw_Basis_time time) {