- 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

original commit: 4339b856d85de4c949ef7c4e66ec679512809a58
This commit is contained in:
Andy Keep 2016-05-15 00:16:15 -04:00
parent 3cf4bdebd7
commit 820f7bccb9
2 changed files with 23 additions and 0 deletions

4
LOG
View File

@ -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

View File

@ -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));
}