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

Read fields directly from ValueTimestampTimeZone

上级 f45373e3
...@@ -13,7 +13,6 @@ import java.sql.Timestamp; ...@@ -13,7 +13,6 @@ import java.sql.Timestamp;
import java.util.Arrays; import java.util.Arrays;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import org.h2.api.TimestampWithTimeZone;
import org.h2.message.DbException; import org.h2.message.DbException;
import org.h2.value.Value; import org.h2.value.Value;
import org.h2.value.ValueDate; import org.h2.value.ValueDate;
...@@ -461,13 +460,12 @@ public class LocalDateTimeUtils { ...@@ -461,13 +460,12 @@ public class LocalDateTimeUtils {
*/ */
public static Object valueToOffsetDateTime(Value value) { public static Object valueToOffsetDateTime(Value value) {
ValueTimestampTimeZone valueTimestampTimeZone = (ValueTimestampTimeZone) value.convertTo(Value.TIMESTAMP_TZ); ValueTimestampTimeZone valueTimestampTimeZone = (ValueTimestampTimeZone) value.convertTo(Value.TIMESTAMP_TZ);
TimestampWithTimeZone timestampWithTimeZone = (TimestampWithTimeZone) valueTimestampTimeZone.getObject(); long dateValue = valueTimestampTimeZone.getDateValue();
long dateValue = timestampWithTimeZone.getYMD(); long timeNanos = valueTimestampTimeZone.getTimeNanos();
long timeNanos = timestampWithTimeZone.getNanosSinceMidnight();
try { try {
Object localDateTime = localDateTimeFromDateNanos(dateValue, timeNanos); Object localDateTime = localDateTimeFromDateNanos(dateValue, timeNanos);
short timeZoneOffsetMins = timestampWithTimeZone.getTimeZoneOffsetMins(); short timeZoneOffsetMins = valueTimestampTimeZone.getTimeZoneOffsetMins();
int offsetSeconds = (int) TimeUnit.MINUTES.toSeconds(timeZoneOffsetMins); int offsetSeconds = (int) TimeUnit.MINUTES.toSeconds(timeZoneOffsetMins);
Object offset = ZONE_OFFSET_OF_TOTAL_SECONDS.invoke(null, offsetSeconds); Object offset = ZONE_OFFSET_OF_TOTAL_SECONDS.invoke(null, offsetSeconds);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论