Hi! I have an application running in cluster mode (two nodes) under tomcat/Linux. Unfortunately I've noticed that node1 and node2 have different time settings. When in a shell I punch "date" I get at both machines the same:
> date --rfc-2822
Thu, 22 Oct 2009 15:00:15 +0200
I wrote a small java program which only prints the formatted date (and time).
import java.util.Date;
import java.util.TimeZone;
public class TimeTest {
public static void main(String args[]) {
long time = System.currentTimeMillis();
String millis = Long.toString(time);
Date date = new Date(time);
System.out.println("Current time in milliseconds = " + millis + " => " + date.toString());
System.out.println("Current time zone: " + TimeZone.getDefault().getID());
}
}
At one node I am getting: Current time in milliseconds = 1256215701981 => Thu Oct 22 13:48:21 GMT+01:00 2009 Current time zone: GMT+01:00
whereas at the other node I am getting: Current time in milliseconds = 1256215779203 => Thu Oct 22 14:49:39 CEST 2009 Current time zone: Europe/Berlin
Is this a Linux setting or a java setting? In any case, how can I change this?
Thanks in advance!
Luis