>We seem to have differences between the unix system time (coming from
>an NTP server) and the time our java application has (as it produces
>timestamps).
>At the start of the app the time is synchro and after about 2 weeks
>the time is 20secs ahead of the system time...
Keep your machines is sync by having them check in with an NTP server.
See http://mindprod.com/jgloss/atomiclock.html
PC's have two clocks, an accurate one, and a time of day ticks since
midnight that is reset on boot. Modern tick clocks are pretty
accurate, but on older machines, they will get out of whack if you
don't reboot daily or resync from the clock calendar. Since accessing
the tick clock is faster, that's what you normally get from Windows
OS.
--
Canadian Mind Products, Roedy Green.
Coaching, problem solving, economical contract programming.
See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.
Liz - 30 Apr 2004 20:28 GMT
> >We seem to have differences between the unix system time (coming from
> >an NTP server) and the time our java application has (as it produces
[quoted text clipped - 4 lines]
> Keep your machines is sync by having them check in with an NTP server.
> See http://mindprod.com/jgloss/atomiclock.html
Win XP uses NTP once per week to reset the clock.
> PC's have two clocks, an accurate one, and a time of day ticks since
> midnight that is reset on boot. Modern tick clocks are pretty
[quoted text clipped - 7 lines]
> Coaching, problem solving, economical contract programming.
> See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.
Hi Steffen
we have notified the same problem, but with a HP/UX Java 1.4.2 VM. Our
timeshift is 5 secs after a couple of weeks. Right at Java VM start we
don't see any time shift between System.currentTimeMillis and the system
time, just as you noted.
Do you have meanwhile an answer to your question, or a workaround? Is this
a bug in the Java VM?
thank you for your reply
Bojan
Bojan Kalan - 03 Feb 2005 08:05 GMT
Release notes for HP/Ux Java VM:
Since SDK 1.2.2.09 and SDK 1.3.1, there has been a change in the way the
HotSpot JVM uses the gettimeofday() system call to obtain date and time
information.
For performance reasons a new mechanism is used that uses the number of cpu
ticks since the application started, to calculate the current time. As a
result, changes to the system date or time using date(1), adjtime(2) or
time synchronization utilities such as ntp will not be reflected in the
date and time that Java returns, until the process is restarted.
If your application requires that Java immediately reflects such system
time changes, you can use the -XX:+UseGetTimeOfDay option to tell the JVM
to use the gettimeofday call instead of the new, lightweight mechanism.
However you may notice a drop in performance,