提交 89bb376d authored 作者: Stéphane Eintrazi's avatar Stéphane Eintrazi

move variables into corresponding block

上级 10147b5c
...@@ -1486,14 +1486,6 @@ public class DateTimeUtils { ...@@ -1486,14 +1486,6 @@ public class DateTimeUtils {
long dateValue = fieldDateAndTime[0]; long dateValue = fieldDateAndTime[0];
long timeNanosRetrieved = fieldDateAndTime[1]; long timeNanosRetrieved = fieldDateAndTime[1];
// Variable that contains the number of nanoseconds in 'hour', 'minute',
// etc.
long nanoInHour = 3_600_000_000_000l;
long nanoInMinute = 60_000_000_000l;
long nanoInSecond = 1_000_000_000l;
long nanoInMilliSecond = 1_000_000l;
long nanoInMicroSecond = 1_000l;
// Variable used to the time in nanoseconds of the date truncated. // Variable used to the time in nanoseconds of the date truncated.
long timeNanos; long timeNanos;
...@@ -1502,26 +1494,31 @@ public class DateTimeUtils { ...@@ -1502,26 +1494,31 @@ public class DateTimeUtils {
// result to nanoseconds. // result to nanoseconds.
if (timeUnit.equals("MICROSECONDS")) { if (timeUnit.equals("MICROSECONDS")) {
long nanoInMicroSecond = 1_000l;
long microseconds = timeNanosRetrieved / nanoInMicroSecond; long microseconds = timeNanosRetrieved / nanoInMicroSecond;
timeNanos = microseconds * nanoInMicroSecond; timeNanos = microseconds * nanoInMicroSecond;
} else if (timeUnit.equals("MILLISECONDS")) { } else if (timeUnit.equals("MILLISECONDS")) {
long nanoInMilliSecond = 1_000_000l;
long milliseconds = timeNanosRetrieved / nanoInMilliSecond; long milliseconds = timeNanosRetrieved / nanoInMilliSecond;
timeNanos = milliseconds * nanoInMilliSecond; timeNanos = milliseconds * nanoInMilliSecond;
} else if (timeUnit.equals("SECOND")) { } else if (timeUnit.equals("SECOND")) {
long nanoInSecond = 1_000_000_000l;
long seconds = timeNanosRetrieved / nanoInSecond; long seconds = timeNanosRetrieved / nanoInSecond;
timeNanos = seconds * nanoInSecond; timeNanos = seconds * nanoInSecond;
} else if (timeUnit.equals("MINUTE")) { } else if (timeUnit.equals("MINUTE")) {
long nanoInMinute = 60_000_000_000l;
long minutes = timeNanosRetrieved / nanoInMinute; long minutes = timeNanosRetrieved / nanoInMinute;
timeNanos = minutes * nanoInMinute; timeNanos = minutes * nanoInMinute;
} else if (timeUnit.equals("HOUR")) { } else if (timeUnit.equals("HOUR")) {
long nanoInHour = 3_600_000_000_000l;
long hours = timeNanosRetrieved / nanoInHour; long hours = timeNanosRetrieved / nanoInHour;
timeNanos = hours * nanoInHour; timeNanos = hours * nanoInHour;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论