More Java posts
June 04, 2003
Java bug 4679060 bites me
The behavior of getTime() on java.sql.Timestamp has changed between 1.3 and 1.4. It used to return only integral seconds in 1.3, it now also returns milliseconds in 1.4. So, my code, which works fine in 1.3 for getting a time accurate to milliseconds,
aTimestamp.getTime() + aTimestamp.getNanos() / 1000000 fails in 1.4. I now have to write (aTimestamp.getTime() / 1000) * 1000 + aTimestamp.getNanos() / 1000000 so that my code works on 1.3 and 1.4. Anyway, here's the link to the bug
Bug ID: 4679060 Documentation of java.sql.Timestamp.getTime() is contradictory
Comments
Post a comment