[jboss-user] [Persistence, JBoss/CMP, Hibernate, Database] - Daylight savings reveals serious brokeness

dpocock do-not-reply at jboss.com
Sat Oct 28 21:24:46 EDT 2006



My environment:

JBoss 4.0.4.GA installed by JEMS installer
Mysql 4.0.24
mysql-connector-java-3.0.16-ga-bin.jar

I was working on an upgrade during the period between 0100 and 0200 BST, before the clock was to be rolled back (i.e. while British Summer Time still in effect).  At this time, I noticed very unusual behaviour in one of my applications:

The application receives valid timestamps (in seconds since UTC) from a switch.

The application would do the following:
call start:
- cdr.setStartTime(new java.util.Date(timestamp * 1000))
- em.persist(cdr)
call connect:
- cdr = em.find(xxx)
- cdr.setConnectTime(new java.util.Date(timestamp * 1000))
- em.persist(cdr)
call stop:
- cdr = em.find(xxx)
- cdr.setFinishTime(new java.util.Date(timestamp * 1000))
- log(cdr.getStartTime().getTime() / 1000)
- log(cdr.getConnectTime().getTime() / 1000)
- log(cdr.getFinishTime().getTime() / 1000)
- em.persist(cdr)

The log output would show that the StartTime and ConnectTime values, when converted back to timestamps with `getTime()', were 3600 seconds ahead of the timestamps that had originally been stored, although finishtime was still the same.

For short calls, the equation (finishtime - connecttime) would return a negative value.

I inspected the database with mysql, all the times stored in SQL format appeared sequential (starttime < connecttime < finishtime)

I waited for the clock to hit 01:59:59 BST, it rolled back to 01:00:00 GMT.  I then repeated the test, and the problem had vanished.

To any worried customers reading this: please note this is not our live VoIP service I am describing.



View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3981566#3981566

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3981566



More information about the jboss-user mailing list