0 Replies Latest reply on Oct 28, 2006 9:24 PM by dpocock

    Daylight savings reveals serious brokeness

    dpocock



      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.