1

I am running a tomcat 7 server on a linux machine.

I run into an issue that when I change the backend clock using the "date" command, the time that i got from

new Date()

is not in sync.

This was fixed by restarting the tomcat server. Is there any way I can fix this issue? I have searched through googld and didn't really find an answer.

Thanks.

AbSoLution8
  • 1,203
  • 1
  • 18
  • 27
  • I think you should wait and see if it happens again (i.e. it's an isolated thing or happens regularly). If it happens again you'll have more information on what caused it – durron597 Nov 09 '12 at 02:30
  • it can be reproduced all the time. As long as I change the linux clock, the java time does not get updated until i restart the tomcat – AbSoLution8 Nov 09 '12 at 02:38
  • Don't take this the wrong way, but how often are you changing the linux system clock? Or are you saying this just happened last week with daylight savings? – durron597 Nov 09 '12 at 02:41
  • it happens anytime. The administrator of my web application will change the back end linux clock depending on when the what time zone the server is serving, can be all over the world – AbSoLution8 Nov 09 '12 at 02:44
  • Why doesn't the administrator just use locale settings in the code, and translate the user's timezone as an offset from the servers? It's not like the server itself is changing time zone – durron597 Nov 09 '12 at 02:45
  • The web application is just an interface for a more complicated back end application that relies on the system clock. Therefore it has to be changed from the system level. – AbSoLution8 Nov 09 '12 at 02:48
  • Ok well, I'm not sure what the right solution is, I don't think what you're asking can be done. However this may help? http://stackoverflow.com/questions/6203857/how-can-i-set-the-system-time-in-java – durron597 Nov 09 '12 at 02:49

1 Answers1

0

If you are using Centos look for /etc/sysconfig/clock file and change the timezone accordingly.