Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / February 2005

Tip: Looking for answers? Try searching our database.

HP/UX Java 1.3.1.02 date/time differences

Thread view: 
Steffen Huebner - 30 Apr 2004 13:36 GMT
Hi!

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...

Does the Java VM calculates the current time by its own (i.e. counting
secs from start)? Or should it better get the time (if
System.currentTimeMillis() is called) from the host system?

Regards,
Steffen
Roedy Green - 30 Apr 2004 19:25 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
>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.
Bojan Kalan - 02 Feb 2005 16:46 GMT
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,


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2010 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.