From 350f87ba4d8e428b2c05bec919e46d6426c3aa2d Mon Sep 17 00:00:00 2001 From: Bob Burger Date: Fri, 29 Dec 2017 18:19:09 -0300 Subject: [PATCH] fix bug in date->time-utc caused by incorrect use of difftime in Windows original commit: 4748dad50c7f0e9b3ba002c27990d4c88c0189fc --- LOG | 4 +++- c/stats.c | 2 +- mats/date.ms | 8 +++++--- release_notes/release_notes.stex | 8 ++++++++ 4 files changed, 17 insertions(+), 5 deletions(-) diff --git a/LOG b/LOG index b6525ad485..0c5d095039 100644 --- a/LOG +++ b/LOG @@ -771,4 +771,6 @@ - fix comment about Sscheme_program main.c - fix even? and odd? to error on exceptional flonums - 5_3.ss, 5_3.ms, fl.ms, root-experr*, patch* \ No newline at end of file + 5_3.ss, 5_3.ms, fl.ms, root-experr*, patch* +- fix bug in date->time-utc caused by incorrect use of difftime in Windows + stats.c, date.ms, release_notes.stex diff --git a/c/stats.c b/c/stats.c index 820db2ace9..0e0eb6c8af 100644 --- a/c/stats.c +++ b/c/stats.c @@ -409,7 +409,7 @@ ptr S_mktime(ptr dtvec) { tzoff = adjust_time_zone(dtvec, &tmx, given_tzoff); - if (tzoff != orig_tzoff) tx = (time_t) difftime(tx, (time_t)(orig_tzoff - tzoff)); + if (tzoff != orig_tzoff) tx = tx - orig_tzoff + tzoff; return Scons(S_integer_time_t(tx), Svector_ref(dtvec, dtvec_nsec)); } diff --git a/mats/date.ms b/mats/date.ms index bcadbe39c0..72c2f464f2 100644 --- a/mats/date.ms +++ b/mats/date.ms @@ -622,9 +622,11 @@ (sleep (make-time 'time-duration 0 1)) (timetime-utc (current-date)))) (let ([t (current-time)]) - (time=? - (date->time-utc (time-utc->date t -14400)) - (date->time-utc (time-utc->date t 0)))) + (and + (time=? (date->time-utc (time-utc->date t)) t) + (time=? (date->time-utc (time-utc->date t -86400)) t) + (time=? (date->time-utc (time-utc->date t 0)) t) + (time=? (date->time-utc (time-utc->date t 86400)) t))) ) (mat time&date-printing diff --git a/release_notes/release_notes.stex b/release_notes/release_notes.stex index c03d353554..2f7f287b56 100644 --- a/release_notes/release_notes.stex +++ b/release_notes/release_notes.stex @@ -1535,6 +1535,14 @@ in fasl files does not generally make sense. %----------------------------------------------------------------------------- \section{Bug Fixes}\label{section:bugfixes} +\subsection{Incorrect handling of offset in +\protect\scheme{date->time-utc} on Windows (9.5)} + +A bug when \scheme{date->time-utc} is called on Windows with a +date-zone-offset smaller than the system's time-zone offset has been +fixed. +[This bug dated back to Version 9.5.] + \subsection{Compiler mishandling of fx /carry operations (9.5)} A bug in the source optimizer that caused an internal compiler error when