diff --git a/LOG b/LOG index 7f825f1642..c407f147e3 100644 --- a/LOG +++ b/LOG @@ -144,3 +144,7 @@ use.stex - updated to curl stex version 1.2.1 configure +- updated the fix to S_mktime to work on windows. the struct tm + structure on windows does not have the tm_gmtoff field used in the + mac and linux version of the code. + stats.c diff --git a/c/stats.c b/c/stats.c index 85ba9b39bb..cd57e58bab 100644 --- a/c/stats.c +++ b/c/stats.c @@ -406,7 +406,26 @@ ptr S_mktime(ptr dtvec) { INITVECTIT(dtvec, dtvec_year) = Sinteger(tmx.tm_year); INITVECTIT(dtvec, dtvec_wday) = Sinteger(tmx.tm_wday); INITVECTIT(dtvec, dtvec_yday) = Sinteger(tmx.tm_yday); +#ifdef WIN32 + { + TIME_ZONE_INFORMATION tz; + DWORD rc = GetTimeZoneInformation(&tz); + long tzoff; + + switch (rc) { + case TIME_ZONE_ID_UNKNOWN: + case TIME_ZONE_ID_STANDARD: + tzoff = tz.Bias * -60; + break; + case TIME_ZONE_ID_DAYLIGHT: + tzoff = (tz.Bias + tz.DaylightBias) * -60; + break; + } + if (tzoff != orig_tzoff) tx = (time_t) difftime(tx, (time_t)(orig_tzoff - tzoff)); + } +#else if (tmx.tm_gmtoff != orig_tzoff) tx = difftime(tx, (time_t)(orig_tzoff - tmx.tm_gmtoff)); +#endif return Scons(S_integer_time_t(tx), Svector_ref(dtvec, dtvec_nsec)); }