提交 3c39f6dd authored 作者: Evgenij Ryazanov's avatar Evgenij Ryazanov

Enlarge possible timezone offset to 18 hours

上级 f4b3e998
...@@ -50,7 +50,7 @@ public class ValueTimestampTimeZone extends Value { ...@@ -50,7 +50,7 @@ public class ValueTimestampTimeZone extends Value {
*/ */
private final long timeNanos; private final long timeNanos;
/** /**
* Time zone offset from UTC in minutes, range of -12hours to +12hours * Time zone offset from UTC in minutes, range of -18 hours to +18 hours
*/ */
private final short timeZoneOffsetMins; private final short timeZoneOffsetMins;
...@@ -60,8 +60,8 @@ public class ValueTimestampTimeZone extends Value { ...@@ -60,8 +60,8 @@ public class ValueTimestampTimeZone extends Value {
throw new IllegalArgumentException( throw new IllegalArgumentException(
"timeNanos out of range " + timeNanos); "timeNanos out of range " + timeNanos);
} }
if (timeZoneOffsetMins < (-12 * 60) if (timeZoneOffsetMins < (-18 * 60)
|| timeZoneOffsetMins >= (12 * 60)) { || timeZoneOffsetMins > (18 * 60)) {
throw new IllegalArgumentException( throw new IllegalArgumentException(
"timeZoneOffsetMins out of range " + timeZoneOffsetMins); "timeZoneOffsetMins out of range " + timeZoneOffsetMins);
} }
......
...@@ -21,7 +21,7 @@ import org.h2.value.ValueTimestampTimeZone; ...@@ -21,7 +21,7 @@ import org.h2.value.ValueTimestampTimeZone;
public class TestDateIso8601 extends TestBase { public class TestDateIso8601 extends TestBase {
private enum Type { private enum Type {
DATE, TIMESTAMP, TIMESTAMP_TIMEZONE_0, TIMESTAMP_TIMEZONE_PLUS_11, TIMESTAMP_TIMEZONE_MINUS_11; DATE, TIMESTAMP, TIMESTAMP_TIMEZONE_0, TIMESTAMP_TIMEZONE_PLUS_18, TIMESTAMP_TIMEZONE_MINUS_18;
} }
private static Type type; private static Type type;
...@@ -46,10 +46,10 @@ public class TestDateIso8601 extends TestBase { ...@@ -46,10 +46,10 @@ public class TestDateIso8601 extends TestBase {
return ValueTimestamp.parse(s); return ValueTimestamp.parse(s);
case TIMESTAMP_TIMEZONE_0: case TIMESTAMP_TIMEZONE_0:
return ValueTimestampTimeZone.parse(s + " 00:00:00.0Z"); return ValueTimestampTimeZone.parse(s + " 00:00:00.0Z");
case TIMESTAMP_TIMEZONE_PLUS_11: case TIMESTAMP_TIMEZONE_PLUS_18:
return ValueTimestampTimeZone.parse(s + " 00:00:00+11:00"); return ValueTimestampTimeZone.parse(s + " 00:00:00+18:00");
case TIMESTAMP_TIMEZONE_MINUS_11: case TIMESTAMP_TIMEZONE_MINUS_18:
return ValueTimestampTimeZone.parse(s + " 00:00:00-11:00"); return ValueTimestampTimeZone.parse(s + " 00:00:00-18:00");
default: default:
throw new IllegalStateException(); throw new IllegalStateException();
} }
...@@ -63,9 +63,9 @@ public class TestDateIso8601 extends TestBase { ...@@ -63,9 +63,9 @@ public class TestDateIso8601 extends TestBase {
doTest(); doTest();
type = Type.TIMESTAMP_TIMEZONE_0; type = Type.TIMESTAMP_TIMEZONE_0;
doTest(); doTest();
type = Type.TIMESTAMP_TIMEZONE_PLUS_11; type = Type.TIMESTAMP_TIMEZONE_PLUS_18;
doTest(); doTest();
type = Type.TIMESTAMP_TIMEZONE_MINUS_11; type = Type.TIMESTAMP_TIMEZONE_MINUS_18;
doTest(); doTest();
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论