[
https://issues.apache.org/jira/browse/DERBY-5965?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13625349#comment-13625349
]
Knut Anders Hatlen commented on DERBY-5965:
-------------------------------------------
The problem seems to be that the timestamp returned by the CURRENT_TIMESTAMP
function is one hour off during the last hour of DST.
For example, with the time set to 2012-10-28 02:30:00, executing the following
code
ResultSet rs = s.executeQuery("values current timestamp");
rs.next();
System.out.println(rs.getTimestamp(1));
System.out.println(new Timestamp(System.currentTimeMillis()));
prints two timestamps that seemingly are close to each other:
2012-10-28 02:30:01.831
2012-10-28 02:30:01.834
However, if you call getTime() on the two timestamps, to get the number of
milliseconds since epoch, you'll see that the former is actually one hour later
than the other, not three milliseconds earlier as the string representation may
suggest.
The test gets the current time by calling System.currentTimeMillis() before and
after the statement is executed, and checks if the generated timestamp is
between those two points in time. Since the timestamp is one hour off, the test
fails.
> TimeHandlingTest.testCurrentTimestamp() failed: CURRENT TIME after end of
> statement
> -----------------------------------------------------------------------------------
>
> Key: DERBY-5965
> URL: https://issues.apache.org/jira/browse/DERBY-5965
> Project: Derby
> Issue Type: Bug
> Components: Test
> Affects Versions: 10.10.1.1
> Reporter: Knut Anders Hatlen
> Priority: Minor
>
> Saw these failures, happening around the time Europe switched from DST:
> http://dbtg.foundry.sun.com/derby/test/Daily/jvm1.5/testing/testlog/sles/1402814-suitesAll_diff.txt
> 1)
> testCurrentTimestamp(org.apache.derbyTesting.functionTests.tests.lang.TimeHandlingTest)junit.framework.AssertionFailedError:
> CURRENT TIME after end of statement
> at
> org.apache.derbyTesting.functionTests.tests.lang.TimeHandlingTest.checkCurrentTimestampValue(TimeHandlingTest.java:804)
> at
> org.apache.derbyTesting.functionTests.tests.lang.TimeHandlingTest.checkCurrentTimestampMultiple(TimeHandlingTest.java:571)
> at
> org.apache.derbyTesting.functionTests.tests.lang.TimeHandlingTest.checkCurrentMultiple(TimeHandlingTest.java:504)
> at
> org.apache.derbyTesting.functionTests.tests.lang.TimeHandlingTest.checkCurrentQuery(TimeHandlingTest.java:479)
> at
> org.apache.derbyTesting.functionTests.tests.lang.TimeHandlingTest.currentFunctionTests(TimeHandlingTest.java:291)
> at
> org.apache.derbyTesting.functionTests.tests.lang.TimeHandlingTest.testCurrentTimestamp(TimeHandlingTest.java:269)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> at
> org.apache.derbyTesting.junit.BaseTestCase.runBare(BaseTestCase.java:117)
> at
> org.apache.derbyTesting.junit.BaseJDBCTestCase.runBareOverridable(BaseJDBCTestCase.java:424)
> at
> org.apache.derbyTesting.junit.BaseJDBCTestCase.runBare(BaseJDBCTestCase.java:441)
> at junit.extensions.TestDecorator.basicRun(TestDecorator.java:24)
> at junit.extensions.TestSetup$1.protect(TestSetup.java:21)
> at junit.extensions.TestSetup.run(TestSetup.java:25)
> at
> org.apache.derbyTesting.junit.BaseTestSetup.run(BaseTestSetup.java:57)
> 2)
> testCurrentTimestamp(org.apache.derbyTesting.functionTests.tests.lang.TimeHandlingTest)junit.framework.AssertionFailedError:
> CURRENT TIME after end of statement
> at
> org.apache.derbyTesting.functionTests.tests.lang.TimeHandlingTest.checkCurrentTimestampValue(TimeHandlingTest.java:804)
> at
> org.apache.derbyTesting.functionTests.tests.lang.TimeHandlingTest.checkCurrentTimestampMultiple(TimeHandlingTest.java:571)
> at
> org.apache.derbyTesting.functionTests.tests.lang.TimeHandlingTest.checkCurrentMultiple(TimeHandlingTest.java:504)
> at
> org.apache.derbyTesting.functionTests.tests.lang.TimeHandlingTest.checkCurrentQuery(TimeHandlingTest.java:479)
> at
> org.apache.derbyTesting.functionTests.tests.lang.TimeHandlingTest.currentFunctionTests(TimeHandlingTest.java:291)
> at
> org.apache.derbyTesting.functionTests.tests.lang.TimeHandlingTest.testCurrentTimestamp(TimeHandlingTest.java:269)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> at
> org.apache.derbyTesting.junit.BaseTestCase.runBare(BaseTestCase.java:117)
> at
> org.apache.derbyTesting.junit.BaseJDBCTestCase.runBareOverridable(BaseJDBCTestCase.java:424)
> at
> org.apache.derbyTesting.junit.BaseJDBCTestCase.runBare(BaseJDBCTestCase.java:441)
> at junit.extensions.TestDecorator.basicRun(TestDecorator.java:24)
> at junit.extensions.TestSetup$1.protect(TestSetup.java:21)
> at junit.extensions.TestSetup.run(TestSetup.java:25)
> at
> org.apache.derbyTesting.junit.BaseTestSetup.run(BaseTestSetup.java:57)
> at junit.extensions.TestDecorator.basicRun(TestDecorator.java:24)
> at junit.extensions.TestSetup$1.protect(TestSetup.java:21)
> at junit.extensions.TestSetup.run(TestSetup.java:25)
> at junit.extensions.TestDecorator.basicRun(TestDecorator.java:24)
> at junit.extensions.TestSetup$1.protect(TestSetup.java:21)
> at junit.extensions.TestSetup.run(TestSetup.java:25)
> at
> org.apache.derbyTesting.junit.BaseTestSetup.run(BaseTestSetup.java:57)
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira