提交 a34de81e authored 作者: Evgenij Ryazanov's avatar Evgenij Ryazanov

Wrap some lines and add comments

上级 cc39a8a3
......@@ -1811,7 +1811,9 @@ public class Function extends Expression implements FunctionCall {
(count > Integer.MAX_VALUE || count < Integer.MIN_VALUE)) {
throw DbException.getInvalidValueException("DATEADD count", count);
}
boolean withDate = !(v instanceof ValueTime), withTime = !(v instanceof ValueDate), forceTimestamp = false;
boolean withDate = !(v instanceof ValueTime);
boolean withTime = !(v instanceof ValueDate);
boolean forceTimestamp = false;
long[] a = DateTimeUtils.dateAndTimeFromValue(v);
long dateValue = a[0];
long timeNanos = a[1];
......
......@@ -922,7 +922,13 @@ public class DateTimeUtils {
if (month != 2) {
return NORMAL_DAYS_PER_MONTH[month];
}
return (year & 3) == 0 && (year < 1582 || year % 100 != 0 || year % 400 == 0) ? 29 : 28;
// All leap years divisible by 4
return (year & 3) == 0
// All such years before 1582 are Julian and leap
&& (year < 1582
// Otherwise check Gregorian conditions
|| year % 100 != 0 || year % 400 == 0)
? 29 : 28;
}
/**
......@@ -1068,7 +1074,9 @@ public class DateTimeUtils {
}
/**
* Get the date value from a given denormalized date.
* Get the date value from a given denormalized date with possible out of range
* values of month and/or day. Used after addition or subtraction month or years
* to (from) it to get a valid date.
*
* @param year
* the year
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论