From 2d2ec051cf1bccebd8ceacb06ffb7ea6f332c72c Mon Sep 17 00:00:00 2001 From: ashok Date: Sun, 10 Jul 2016 06:41:54 +0000 Subject: Bugfix [da340d4f32]. clock-55.9 and clock-55.10 test failures. --- generic/tclClock.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/generic/tclClock.c b/generic/tclClock.c index 949cb1c..c3b29e9 100644 --- a/generic/tclClock.c +++ b/generic/tclClock.c @@ -1499,7 +1499,19 @@ GetJulianDayFromEraYearMonthDay( * Try an initial conversion in the Gregorian calendar. */ +#if 0 /* BUG http://core.tcl.tk/tcl/tktview?name=da340d4f32 */ ym1o4 = ym1 / 4; +#else + /* + * Have to make sure quotient is truncated towards 0 when negative. + * See above bug for details. The casts are necessary. + */ + if (ym1 >= 0) + ym1o4 = ym1 / 4; + else { + ym1o4 = - (int) (((unsigned int) -ym1) / 4); + } +#endif if (ym1 % 4 < 0) { ym1o4--; } -- cgit v0.12