I have 2 linux servers and code to run according to the current time. A loop should run from 00:00 to 23:55 local time.
Calendar c = Calendar.getInstance();
if (c.get(Calendar.HOUR_OF_DAY) > 22 && c.get(Calendar.MINUTE) >= 55) {
/* ... */
/* ... */
} else {
Thread.sleep(1000 * timeToSleep);
}
I have the above given logic. But since the BST has come into effect since late march this code has been posing a problem in 1 server. While in server1 this starts at 00:00 and ends at 23:55 which is correct. In server2 the code is not ending at 23:55 instead 00:55.
We assumed that the code is still picking GMT (in winters for U.K.) but then the other server should have faced the problem. Why is it happening on 1 server this runs fine while on other wrong time is picked. All the configs what i have seen are more or less same for both the servers.