Server Clock Problem

Discussion in 'Programming' started by 137th Gebirg, Feb 17, 2012.

  1. #1
    Hey all - we just upgraded to ColdFusion 9 on both a development and production server and everything seems to be running pretty smoothly, with one exception. The weird thing is that time stamps generated by #DateFormat(Now(), "[mask]")# on development are correct but the same line of code running in production produces a time output string exactly 10 hours later! What makes it weirder is that the physical Windows 2003 server the CF9 server is running shows the proper date stamp and time zone.

    Is there some offset adjustment setting buried in the configuration somewhere that needs to be re-calibrated? It's kind of frustrating, as we didn't experience this problem prior to the upgrade and the dev server seems to be chugging along normally with the time stamps. Any info appreciated...
     
    137th Gebirg, Feb 17, 2012 IP
  2. 137th Gebirg

    137th Gebirg Active Member

    Messages:
    70
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    91
    #2
    Well, I figured out what happened, in case anyone else has the same problem in the future. It seems that the Java Runtime Environment has its own clock that ColdFusion derives its timestamps from (for whatever reason - I really hate Java). Unless it is precisely set, it will render any timestamps as it sees fit. In my case, it thought my server was in "Asia/Karachi". Go figure... :confused: Anyways, in the CF admin tool, go to "Server Settings > Java and JVM". In the "JVM Arguments" text box, add the following text to the virtual machine parameter string: "-Duser.timezone=GMT-5" or any plus/minus figure to match your locale - in my case, EST. Restart the ColdFusion 9 Application Server in the Services control panel and voila! Correct time has returned and all is well again.

    Did I mention I really hate Java? :mad:
     
    137th Gebirg, Feb 22, 2012 IP
  3. Renatus

    Renatus Member

    Messages:
    216
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    35
    #3
    Interesting solution to the problem, thank you for sharing it.
     
    Renatus, Dec 3, 2012 IP