Server Time & Lucee Time

175 views
Skip to first unread message

W. Williams

unread,
Oct 20, 2016, 9:49:31 AM10/20/16
to Lucee
Hey guys,

While I'm not to worried about it, I noticed this week that on the Lucee Admin Regional page that the times were the same.  This is not the case!  The server is set to use UTC and on the Regional page we have Lucee set to use US/Central.  Both times are showing US/Central.

Anyone know why this is happening?  We are running Lucee 5.0.1.67-SNAPSHOT on a linux box.  Any thoughts or help would be appreciated.

Thanks!

Andrew Dixon

unread,
Oct 20, 2016, 4:18:56 PM10/20/16
to lu...@googlegroups.com
Hi,

I'm not seeing this on my server. I have the server set to BST and for one particular site it is set to Australia/Sydney and showing correctly:

Inline images 1

Are you 100% sure the server is set to UTC? If you type date at the command prompt it will show you.

Kind regards,

Andrew

--
Get 10% off of the regular price for this years CFCamp in Munich, Germany (Oct. 20th & 21st) with the Lucee discount code Lucee@cfcamp. 189€ instead of 210€. Visit https://ti.to/cfcamp/cfcamp-2016/discount/Lucee@cfcamp
---
You received this message because you are subscribed to the Google Groups "Lucee" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lucee+unsubscribe@googlegroups.com.
To post to this group, send email to lu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/lucee/7c6acce3-8188-49d0-bafc-3479bfe48f49%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

W. Williams

unread,
Nov 4, 2016, 1:52:20 AM11/4/16
to Lucee
After a few weeks of playing, we have 4 servers all with this issue. When typing date in the terminal, it is set to UTC. We have tripple checked this on all servers.

We are using US / Central Time as the Lucee time. Within the Lucee Admin, both times are the same.

Where does Lucee pull the server time from? Anyone have any thoughts? Concerned about the time change this weekend.

Joseph Gooch

unread,
Nov 4, 2016, 7:34:22 AM11/4/16
to lu...@googlegroups.com
When you start lucee, do you set the TZ environment variable?

For instance, on my mac:
$ date
Fri Nov  4 07:30:50 EDT 2016

$ env TZ=US/Central date
Fri Nov  4 06:30:54 CDT 2016

POSIX OS's will auto-translate if the TZ variable is set. If it's not set, it'll use whatever /etc/localtime says, which I'm guessing in your case is UTC.

Related/supporting info

I'm not sure what Lucee does internally to show that information.


Joe


--
Get 10% off of the regular price for this years CFCamp in Munich, Germany (Oct. 20th & 21st) with the Lucee discount code Lucee@cfcamp. 189€ instead of 210€. Visit https://ti.to/cfcamp/cfcamp-2016/discount/Lucee@cfcamp
---
You received this message because you are subscribed to the Google Groups "Lucee" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lucee+unsubscribe@googlegroups.com.
To post to this group, send email to lu...@googlegroups.com.

Joseph Gooch

unread,
Nov 4, 2016, 7:37:08 AM11/4/16
to lu...@googlegroups.com
If you're concerned about the time change, can't you temporarily change the clock on one of the servers and verify Lucee responds properly?

Joe

Mark Drew

unread,
Nov 4, 2016, 7:37:10 AM11/4/16
to lucee
If you go to the lucee admin you should see the time server:

Joseph Gooch

unread,
Nov 4, 2016, 7:52:41 AM11/4/16
to lu...@googlegroups.com
Try this code:
<cfoutput>
  Server Date/Time: #lsdateFormat(date:now(),timezone:"jvm")# #lstimeFormat(time:now(),timezone:"jvm")#<br/>
  Lucee  Date/Time: #lsdateFormat(date:now())# #lstimeFormat(time:now())#<br/>
  JVM(System) Timezone: #createobject("java","java.util.TimeZone").getDefault().getId()#<br/>
  PageContext(Lucee) Timezone: #getPageContext().getTimeZone()#
</cfoutput>

The first two outputted lines is exactly what the overview.cfm in the administrator does.  Note Lucee uses date/timeformat without a timezone, so whatever is in PageContext (administrator) stands.  The System time uses the JVM's timezone.

That means if you're changing the JVM's timezone with the TZ variable or -Duser.timezone.... the "System" time will be in whatever the JVM has been told to use. (Regardless of what the date command says)

Joe

W. Williams

unread,
Nov 4, 2016, 9:22:19 AM11/4/16
to Lucee
Thx Joe!  Ok, I ran the code and here is what I got:

Server Date/Time: Nov 4, 2016 8:08 AM
Lucee Date/Time: Nov 4, 2016 8:08 AM
JVM(System) Timezone: US/Central
PageContext(Lucee) Timezone: US/Central

As you thought, the JVM is using US/Central.  The issue is that I am not defining this anywhere.  I'm launching lucee and Apache using the rc.local in the /etc/rc.d/ directory with /sbin/service railo_ctl start command.

The Lucee config is set to US/Central and that is the only setting I have changed.  Running date from the terminal on the server shows:

Fri Nov  4 13:08:41 UTC 2016

How can I correct this?  Is there a setting in the server.xml or web.xml I should be seeing.  I have looked and I see nothing.

Joseph Gooch

unread,
Nov 4, 2016, 9:39:29 AM11/4/16
to lu...@googlegroups.com
You can add export TZ=UTC in /etc/init.d/railo_ctl.  You might want to check that script to see if there's already a TZ setting in there.

You could also look in the java System Properties to see if user.timezone is getting set somewhere. (i.e. <cfdump var="#createobject("java","java.lang.System").getProperties()#" />)  If it is, it's probably in tomcat somewhere. ( bin/setenv.sh, maybe conf/catalina.properties or any number of the tomcat configs... assuming you're running tomcat)

(in fact, bin/setenv.sh in tomcat might be a better place to put the TZ than modifying the init.d script)

Joe





--
Get 10% off of the regular price for this years CFCamp in Munich, Germany (Oct. 20th & 21st) with the Lucee discount code Lucee@cfcamp. 189€ instead of 210€. Visit https://ti.to/cfcamp/cfcamp-2016/discount/Lucee@cfcamp
---
You received this message because you are subscribed to the Google Groups "Lucee" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lucee+unsubscribe@googlegroups.com.
To post to this group, send email to lu...@googlegroups.com.

W. Williams

unread,
Nov 4, 2016, 10:08:07 AM11/4/16
to Lucee
Joe,

So I looked in all the tomcat configs and I found nothing.  I might have just found the issue / reason.  I ran your <cfdump var="#createobject("java","java.lang.System").getProperties()#" /> and it shows "user.timezone string UTC".  So not set anywhere there (Trust me, I was pulling out my hair).  

Then it hit me:

I went back and looked at the previous posts and noticed that all screen grabs were from the web admin and NOT the server admin.  All the sites on these servers belong to our company and we don't use any site specific settings, they are all Lucee server settings.  Is the Lucess server admin setting a global time and that is what is being displayed as the "Server Time"?  If I change the server TZ setting in the server admin to UTC it changes the Lucee time to UTC but Server time stays on US/Central.  If I reboot the box will it change the server time too (NOTE: This is a box that is in production and a reboot is not possible at this moment)?


Reply all
Reply to author
Forward
0 new messages