提交 8d221f87 authored 作者: Thomas Mueller's avatar Thomas Mueller

Timestamps with timezone that were passed as a string were not always converted…

Timestamps with timezone that were passed as a string were not always converted correctly. For example "2012-11-06T23:00:00.000Z" was converted to "2012-11-06" instead of to "2012-11-07" in the timezone CET.
上级 10757c6a
...@@ -18,7 +18,11 @@ Change Log ...@@ -18,7 +18,11 @@ Change Log
<h1>Change Log</h1> <h1>Change Log</h1>
<h2>Next Version (unreleased)</h2> <h2>Next Version (unreleased)</h2>
<ul><li>New table engine "org.h2.mvstore.db.MVTableEngine" <ul><li>Timestamps with timezone that were passed as a string were not always
converted correctly. For example "2012-11-06T23:00:00.000Z" was converted to
"2012-11-06" instead of to "2012-11-07" in the timezone CET.
Thanks a lot to Steve Hruda for reporting the problem!
</li><li>New table engine "org.h2.mvstore.db.MVTableEngine"
that internally uses the MVStore to persist data. that internally uses the MVStore to persist data.
To try it out, append ";DEFAULT_TABLE_ENGINE=org.h2.mvstore.db.MVTableEngine" To try it out, append ";DEFAULT_TABLE_ENGINE=org.h2.mvstore.db.MVTableEngine"
to the database URL. to the database URL.
...@@ -27,6 +31,7 @@ Change Log ...@@ -27,6 +31,7 @@ Change Log
</li><li>New connection setting "DEFAULT_TABLE_ENGINE" to use a specific </li><li>New connection setting "DEFAULT_TABLE_ENGINE" to use a specific
table engine if none is set explicitly. This is to simplify testing table engine if none is set explicitly. This is to simplify testing
the MVStore table engine. the MVStore table engine.
</li><li>MVStore: maps can now be renamed.
</li><li>MVStore: store the file header also at the end of each chunk, </li><li>MVStore: store the file header also at the end of each chunk,
which results in a further reduced number of write operations. which results in a further reduced number of write operations.
</li><li>MVStore: a map implementation that supports concurrent operations. </li><li>MVStore: a map implementation that supports concurrent operations.
......
...@@ -204,7 +204,7 @@ public class DateTimeUtils { ...@@ -204,7 +204,7 @@ public class DateTimeUtils {
* *
* @param x the date to convert * @param x the date to convert
* @param target the calendar with the target timezone * @param target the calendar with the target timezone
* @return the milliseconds the milliseconds in UTC * @return the milliseconds in UTC
*/ */
public static long convertToLocal(java.util.Date x, Calendar target) { public static long convertToLocal(java.util.Date x, Calendar target) {
if (target == null) { if (target == null) {
......
...@@ -153,6 +153,7 @@ public class ValueTimestamp extends Value { ...@@ -153,6 +153,7 @@ public class ValueTimestamp extends Value {
ms = DateTimeUtils.convertToLocal(new Date(millis), Calendar.getInstance(TimeZone.getTimeZone("UTC"))); ms = DateTimeUtils.convertToLocal(new Date(millis), Calendar.getInstance(TimeZone.getTimeZone("UTC")));
long md = DateTimeUtils.MILLIS_PER_DAY; long md = DateTimeUtils.MILLIS_PER_DAY;
long absoluteDay = (ms >= 0 ? ms : ms - md + 1) / md; long absoluteDay = (ms >= 0 ? ms : ms - md + 1) / md;
dateValue = DateTimeUtils.dateValueFromAbsoluteDay(absoluteDay);
ms -= absoluteDay * md; ms -= absoluteDay * md;
nanos += ms * 1000000; nanos += ms * 1000000;
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论