提交 76021805 authored 作者: Thomas Mueller's avatar Thomas Mueller

Reduce the time between reading millis and nanos, to avoid problems if the…

Reduce the time between reading millis and nanos, to avoid problems if the timestamp is concurrently updated.
上级 5054bfd6
......@@ -66,9 +66,9 @@ public class ValueTimestamp extends Value {
*/
public static ValueTimestamp get(Timestamp timestamp) {
long ms = timestamp.getTime();
long nanos = timestamp.getNanos() % 1000000;
long dateValue = DateTimeUtils.dateValueFromDate(ms);
long nanos = DateTimeUtils.nanosFromDate(ms);
nanos += timestamp.getNanos() % 1000000;
nanos += DateTimeUtils.nanosFromDate(ms);
return fromDateValueAndNanos(dateValue, nanos);
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论