Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
0e36eb37
提交
0e36eb37
authored
9 年前
作者:
Niklas Mehner
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'master' of
https://github.com/h2database/h2database
上级
088746ee
8a352ebd
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
9 个修改的文件
包含
838 行增加
和
789 行删除
+838
-789
changelog.html
h2/src/docsrc/html/changelog.html
+2
-0
_messages_cs.prop
h2/src/main/org/h2/res/_messages_cs.prop
+144
-144
_messages_ja.prop
h2/src/main/org/h2/res/_messages_ja.prop
+162
-162
_messages_ru.prop
h2/src/main/org/h2/res/_messages_ru.prop
+162
-162
_messages_sk.prop
h2/src/main/org/h2/res/_messages_sk.prop
+157
-157
_messages_zh_cn.prop
h2/src/main/org/h2/res/_messages_zh_cn.prop
+162
-162
DateTimeUtils.java
h2/src/main/org/h2/util/DateTimeUtils.java
+9
-2
TestAll.java
h2/src/test/org/h2/test/TestAll.java
+2
-0
TestDateTimeUtils.java
h2/src/test/org/h2/test/unit/TestDateTimeUtils.java
+38
-0
没有找到文件。
h2/src/docsrc/html/changelog.html
浏览文件 @
0e36eb37
...
...
@@ -21,6 +21,8 @@ Change Log
<h2>
Next Version (unreleased)
</h2>
<ul>
<li>
Support for DB2 time format, patch by Niklas Mehner
</li>
<li>
Added support for Connection.setClientInfo() in compatibility modes for DB2, Postgresql, Oracle and MySQL.
</li>
<li>
Issue #249: Clarify license declaration in Maven POM xml
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/res/_messages_cs.prop
浏览文件 @
0e36eb37
差异被折叠。
点击展开。
h2/src/main/org/h2/res/_messages_ja.prop
浏览文件 @
0e36eb37
差异被折叠。
点击展开。
h2/src/main/org/h2/res/_messages_ru.prop
浏览文件 @
0e36eb37
差异被折叠。
点击展开。
h2/src/main/org/h2/res/_messages_sk.prop
浏览文件 @
0e36eb37
差异被折叠。
点击展开。
h2/src/main/org/h2/res/_messages_zh_cn.prop
浏览文件 @
0e36eb37
差异被折叠。
点击展开。
h2/src/main/org/h2/util/DateTimeUtils.java
浏览文件 @
0e36eb37
...
...
@@ -314,7 +314,7 @@ public class DateTimeUtils {
}
/**
* Parse a time string. The format is: [-]hour:minute:second[.nanos]
* Parse a time string. The format is: [-]hour:minute:second[.nanos]
or alternatively [-]hour.minute.second[.nanos].
*
* @param s the string to parse
* @param start the parse index start
...
...
@@ -332,7 +332,14 @@ public class DateTimeUtils {
int
s2
=
s
.
indexOf
(
':'
,
s1
+
1
);
int
s3
=
s
.
indexOf
(
'.'
,
s2
+
1
);
if
(
s1
<=
0
||
s2
<=
s1
)
{
throw
new
IllegalArgumentException
(
s
);
// if first try fails try to use IBM DB2 time format [-]hour.minute.second[.nanos]
s1
=
s
.
indexOf
(
'.'
,
start
);
s2
=
s
.
indexOf
(
'.'
,
s1
+
1
);
s3
=
s
.
indexOf
(
'.'
,
s2
+
1
);
if
(
s1
<=
0
||
s2
<=
s1
)
{
throw
new
IllegalArgumentException
(
s
);
}
}
boolean
negative
;
hour
=
Integer
.
parseInt
(
s
.
substring
(
start
,
s1
));
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/TestAll.java
浏览文件 @
0e36eb37
...
...
@@ -170,6 +170,7 @@ import org.h2.test.unit.TestConnectionInfo;
import
org.h2.test.unit.TestDataPage
;
import
org.h2.test.unit.TestDate
;
import
org.h2.test.unit.TestDateIso8601
;
import
org.h2.test.unit.TestDateTimeUtils
;
import
org.h2.test.unit.TestExit
;
import
org.h2.test.unit.TestFile
;
import
org.h2.test.unit.TestFileLock
;
...
...
@@ -871,6 +872,7 @@ kill -9 `jps -l | grep "org.h2.test." | cut -d " " -f 1`
// serial
addTest
(
new
TestDate
());
addTest
(
new
TestDateTimeUtils
());
addTest
(
new
TestCluster
());
addTest
(
new
TestConcurrent
());
addTest
(
new
TestFileLockSerialized
());
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/unit/TestDateTimeUtils.java
0 → 100644
浏览文件 @
0e36eb37
/*
* Copyright 2004-2014 H2 Group. Multiple-Licensed under the MPL 2.0,
* and the EPL 1.0 (http://h2database.com/html/license.html).
* Initial Developer: H2 Group
*/
package
org
.
h2
.
test
.
unit
;
import
org.h2.test.TestBase
;
import
org.h2.util.DateTimeUtils
;
/**
* Unit tests for the DateTimeUtils class
*/
public
class
TestDateTimeUtils
extends
TestBase
{
/**
* Run just this test.
*
* @param a ignored
*/
public
static
void
main
(
String
...
a
)
throws
Exception
{
// System.setProperty("h2.storeLocalTime", "true");
TestBase
.
createCaller
().
init
().
test
();
}
@Override
public
void
test
()
throws
Exception
{
testParseTimeNanosDB2Format
();
}
private
void
testParseTimeNanosDB2Format
()
{
assertEquals
(
3723004000000L
,
DateTimeUtils
.
parseTimeNanos
(
"01:02:03.004"
,
0
,
12
,
true
));
assertEquals
(
3723004000000L
,
DateTimeUtils
.
parseTimeNanos
(
"01.02.03.004"
,
0
,
12
,
true
));
assertEquals
(
3723000000000L
,
DateTimeUtils
.
parseTimeNanos
(
"01:02:03"
,
0
,
8
,
true
));
assertEquals
(
3723000000000L
,
DateTimeUtils
.
parseTimeNanos
(
"01.02.03"
,
0
,
8
,
true
));
}
}
This diff is collapsed.
Click to expand it.
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论