We noticed today that the system time on our server where CF is running was three hours off. The admins fixed the system time, but the time that ColdFusion outputs using its Now() function is still three hours off. Does updating the system time require a CF restart? Could it be that ColdFusion separately manages its time internally once it comes up, unrelated to system time?
Look and see if you have the parameter -Duser.timezone coded on your JVM settings in the CF administrator, that may be overriding your server time zone.
Thanks, John123. We checked for that param and it was not present.
Although it wasn't our first choice, we opted to reboot the whole server last night after hours, and that fixed the time difference. Although this fixes my issue, I'm not thinking it truly answers the question of why CF differed from the system. Was there a glitch of some kind, or does CF take a snapshot of the system time when it starts up and then manage time separately from the server afterward? I couldn't find anything else online about it.
Copy link to clipboard
Dordrecht, did your admins change the TIME on the server, or the server's time ZONE setting? The latter would make sense, since most systems now rely on an internet time server to know the time. But often their timezone is off and may need to be changed.
If they did change only the system's time ZONE, then what happened makes more sense. Let me explain.
To be clear, this is not about cf but the jvm on which cf runs. It defaults to using the system timezone on start, unless (as John noted) you DID set the timezone in Java, but you clarify that you did not.
But the issue here is that the jvm does NOT auto-detect your changing the os time ZONE once the jvm (cf) running. (It WOULD have detected if you'd changed the server TIME, but you did not, right? just the timezone?)
And so yes, resarting only cf would have fixed things, as did the box reboot.
Finally, as for your not finding more on this on the web, that may be so if you searched relative to cf. But if you search relative to java instead, a first result could have been this SO exchange (about the same issue in Tomcat), where one guy addresses the point in excessive detail (which is saying something, coming from me!):
Hope my clarification helps.
That answer seems highly likely. I marked this as the correct answer, and will update it if I find that the time rather than the zone was altered on the server.
Thanks Charlie! It looks like you came through again!
Thanks, and I'd look forward to that confirmation, either way. What doesn't kill us makes us stronger. 🙂