summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorashok <ashok>2016-07-10 06:41:54 (GMT)
committerashok <ashok>2016-07-10 06:41:54 (GMT)
commit31ec149e21d47b016e7febc2491c31b1cdb3f6a5 (patch)
treee6c01d8530843cda7e9abf9459e867d0b0b91fcc
parent6076256c3fd10a1dc4ab4a315fe018e68d0933ed (diff)
downloadtcl-31ec149e21d47b016e7febc2491c31b1cdb3f6a5.zip
tcl-31ec149e21d47b016e7febc2491c31b1cdb3f6a5.tar.gz
tcl-31ec149e21d47b016e7febc2491c31b1cdb3f6a5.tar.bz2
Bugfix [da340d4f32]. clock-55.9 and clock-55.10 test failures.
-rw-r--r--generic/tclClock.c12
1 files changed, 12 insertions, 0 deletions
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--;
}