From: Taylor R Campbell Date: Mon, 14 Feb 2011 17:39:45 +0000 (+0000) Subject: Fix ENCODE-TIME to correctly handle negative time zones. X-Git-Tag: 20110426-Gtk~2^2~37 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=fdf773bec37e1b71078dc4e1aac1657add9223e5;p=mit-scheme.git Fix ENCODE-TIME to correctly handle negative time zones. This bug has been lying here for fifteen years. Obviously we need more MIT Scheme hackers in the western hemisphere... All this time and date code desperately needs a lot of automatic tests, too. --- diff --git a/src/microcode/prosenv.c b/src/microcode/prosenv.c index 72f9a1304..5de256ec8 100644 --- a/src/microcode/prosenv.c +++ b/src/microcode/prosenv.c @@ -116,8 +116,8 @@ DEFINE_PRIMITIVE ("ENCODE-TIME", Prim_encode_time, 1, 1, (ts . time_zone) = (((len > 9) && (INTEGER_P (VECTOR_REF (vec, 9))) - && (integer_to_ulong_p (VECTOR_REF (vec, 9)))) - ? (integer_to_ulong (VECTOR_REF (vec, 9))) + && (integer_to_long_p (VECTOR_REF (vec, 9)))) + ? (integer_to_long (VECTOR_REF (vec, 9))) : INT_MAX); PRIMITIVE_RETURN (intmax_to_integer (OS_encode_time (&ts))); }