summaryrefslogtreecommitdiffstats
path: root/generic/tclClock.c
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2016-07-13 13:06:31 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2016-07-13 13:06:31 (GMT)
commit6abb3012d4a69c475e76e779b90400ec16d75cef (patch)
treeaf53162be96d78aebb3302888e21a19a8bac027e /generic/tclClock.c
parentd5259dab0165d9c7445e14676e009bb55213aace (diff)
parenta5748bcfeaed4a02c8b11829a0ea0a13dceb8ff9 (diff)
downloadtcl-6abb3012d4a69c475e76e779b90400ec16d75cef.zip
tcl-6abb3012d4a69c475e76e779b90400ec16d75cef.tar.gz
tcl-6abb3012d4a69c475e76e779b90400ec16d75cef.tar.bz2
Merge novem
Diffstat (limited to 'generic/tclClock.c')
-rw-r--r--generic/tclClock.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/generic/tclClock.c b/generic/tclClock.c
index fb97b9c..73f3416 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--;
}