summaryrefslogtreecommitdiffstats
path: root/generic/tclClock.c
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2016-11-16 15:59:40 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2016-11-16 15:59:40 (GMT)
commitfe8f0c596ee02b8811d1d2f4d23b8fdbb166a2ed (patch)
treec97e96389c58ac76d16b27fe19ddb3689118e093 /generic/tclClock.c
parent74cee16544d00f49288f1819fb71e1c5c74ce5ad (diff)
parent29606e4a7b43adb9f923fb5781d3b9a93d9ba1c8 (diff)
downloadtcl-gahr_ticket_e6f27aa56f.zip
tcl-gahr_ticket_e6f27aa56f.tar.gz
tcl-gahr_ticket_e6f27aa56f.tar.bz2
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 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--;
}