提交 0a5a9961 authored 作者: Evgenij Ryazanov's avatar Evgenij Ryazanov

Year 1900 can use fast path in absoluteDayFromDateValue()

上级 c741b8cc
...@@ -1245,10 +1245,10 @@ public class DateTimeUtils { ...@@ -1245,10 +1245,10 @@ public class DateTimeUtils {
m += 12; m += 12;
} }
long a = ((y * 2922L) >> 3) + DAYS_OFFSET[m - 3] + d - 719_484; long a = ((y * 2922L) >> 3) + DAYS_OFFSET[m - 3] + d - 719_484;
if (y <= 1582 && ((y < 1582) || (m * 100 + d < 1015))) { if (y <= 1582 && ((y < 1582) || (m * 100 + d < 10_15))) {
// Julian calendar (cutover at 1582-10-04 / 1582-10-15) // Julian calendar (cutover at 1582-10-04 / 1582-10-15)
a += 13; a += 13;
} else if (y < 1901 || y > 2099) { } else if (y < 1900 || y > 2099) {
// Gregorian calendar (slow mode) // Gregorian calendar (slow mode)
a += (y / 400) - (y / 100) + 15; a += (y / 400) - (y / 100) + 15;
} }
...@@ -1271,7 +1271,7 @@ public class DateTimeUtils { ...@@ -1271,7 +1271,7 @@ public class DateTimeUtils {
m += 12; m += 12;
} }
long a = ((y * 2922L) >> 3) + DAYS_OFFSET[m - 3] + d - 719_484; long a = ((y * 2922L) >> 3) + DAYS_OFFSET[m - 3] + d - 719_484;
if (y < 1901 || y > 2099) { if (y < 1900 || y > 2099) {
// Slow mode // Slow mode
a += (y / 400) - (y / 100) + 15; a += (y / 400) - (y / 100) + 15;
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论