summaryrefslogtreecommitdiffstats
path: root/generic/tclClock.c
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2016-07-10 19:35:28 (GMT)
committerdgp <dgp@users.sourceforge.net>2016-07-10 19:35:28 (GMT)
commit6abeee6109c0fc8822a47a1f586645df9ed5a141 (patch)
tree9e54ef87877a94bb371ef1f8f2172fd5e95703bc /generic/tclClock.c
parent3408cb4caba6bdda86ed5bd407f26f9f9fff9948 (diff)
parent9b324cef64de435d71e385c5efa645cb8e784ba3 (diff)
downloadtcl-6abeee6109c0fc8822a47a1f586645df9ed5a141.zip
tcl-6abeee6109c0fc8822a47a1f586645df9ed5a141.tar.gz
tcl-6abeee6109c0fc8822a47a1f586645df9ed5a141.tar.bz2
merge trunk
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 a458cb9..26e9b4a 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--;
}