Emergency : Wrong time clock


The time shown in the server admin is wrong. The function Now return the wrong value too. We tried a lot of things without success.

Do I need to restart the Lucee service?


I think Lucer gets the time from a third party time server. Log into your lucee server admin and look for that setting. I’m not at home right now to tell you more acurate information, but I think you can set the time to OS also, or similar. Also, maybe you have a firewall blocking the connection to that time server. Not sure, just a shot into the dark.

We tried to change it to 0.ca.pool.ntp.org and use time server checked, we can ping this address but the time is still wrong.

The Windows server is at 13:40. See the screenshot of the server admin.

We had to restart the Lucee service and the time is ok in Lucee now.

I believe it all comes from Windows time. Around noon today, we noticed that the time had jumped 4 hours ahead. We fixed it quickly in Windows, but then Lucee went back like 4 or 5 hours backward and we couldn’t fix it except by restarting Lucee’s service.

Now, many of the transactions are at the wrong time.

It makes me a little nervous what happened. I hope it will not be frequent…

Do you know what is happening under the hood about the current time and the time zone? Does Lucee use the Windows server clock and adjust it’s time with it and the time zone selected in the Server admin?

That is odd. In my 10 years of running Railo or Lucee, such a thing never happened to me. Never saw such an issue.

Is there a way to force Lucee to refresh his clock without restarting it?

From my understanding, Lucee doesn’t have a “clock”. If you look at how the now() function works, it just returns


which is coming straight from java.


Lucee then adjusts it based on the time zone offset you have chosen. So if Lucee is returning the wrong time, that means either the timezone is wrong or Java itself has the wrong time, and I have no idea how Java gets the time but I assume it comes from the actual OS.

It’s really strange what happened. The Windows server changed time, maybe based on the host server, but even changing the time of the Windows server where Lucee is installed, Lucee’s time remained incorrect until we restarted the service of Tomcat / Lucee. We made the adjustments in Windows to keep the time always correct, but I still find it strange that Lucee did not adjust his time in real time from the Windows clock.

When this situation happened, my colleagues told me that they couldn’t change the time zone in Lucee’s admin server either.

Explain. What happened when they tried? An error? Something else?

I asked them for clarification, and they were able to change the timezone in Lucee’s admin server, but it had no effect on Lucee’s time.

Does changing the timezone in Lucee’s admin normally affect the time? For example, there are many places you can set a time zone in Lucee and there is an order of precedence for what setting is used.

A time zone can be specified

  • in the server admin (overridden by anything else)
  • in the web admin (overridden by application and request settings)
  • in the Application.cfc (overriden by SetTimeZone()
  • in a given request by calling SetTimeZone()

Without being able to see all that you have going on, it’s really hard to definitively tell what was happening and if the settings you tried to change would have even made a difference under normal circumstances.

Again, Lucee does not store time, java does. Lucee is just asking Java for the time. You’d be better off IMO searching then internet for what Java does when the OS clock changes. From what I’ve seen , it depends on what specific underlying methods in java you’re calling. Which means you’d also need to share here the exact CFML code you were testing with in order to know what exact java methods were involved under the hood.

Thank you @andreas and @bdw429s for your help.

In the server admin and web admin, it’s the same settings like the screenshot I sent. I looked at all web contexts. Same settings.

I had nothing in the application.cfc before this event, so I added <cfset THIS.timezone = "America/Toronto"> in my application.cfc. It changed nothing.

I don’t use SetTimeZone in my application.