Skip to Main Content

Java HotSpot Virtual Machine

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

JVM Time not correct

843829Feb 2 2008 — edited Mar 31 2008
I have read postings about JVM time drift relative to OS time, but this problem seems different. My ISP running my JSP app insists the server time is accurate to within a second, but the times I'm getting in the app are off by 30 minutes or more. I've tried restarting the app which didn't help. I'm using tomcat-5.5.9 and jdk1.5.0. The following code illustrates the problem.

At 5:21 pm PST which by my watch is 8:21 pm PST, I ran the following Java
code (myTime is my Class that uses java.util.Calendar):
  myTime time = new myTime();
  log.debug(msgHdr +" MyTime with Calendar.getInstance(): "+ 
time.getDisplay());
  long millis = System.currentTimeMillis();
  log.debug(msgHdr +" System time in millis: "+ millis);
  time.getMyTime().setTimeInMillis(millis);
  log.debug(msgHdr +" MyTime with system time put in myTime calendar: "+ 
time.getDisplay());
The output I got is:

DEBUG - BGCC: TennisClub.scheduling.ScheduleBean MyTime with
Calendar.getIntance(): 8:59 PM
DEBUG - BGCC: TennisClub.scheduling.ScheduleBean System time in millis:
1202003941645
DEBUG - BGCC: TennisClub.scheduling.ScheduleBean MyTime with system time put
in myTime calendar: 8:59 PM

Therefore, the system time is 38 minutes ahead of the actual clock time?

Thanks.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 28 2008
Added on Feb 2 2008
5 comments
379 views