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 / July 2007

Tip: Looking for answers? Try searching our database.

Java Time Discrepancy

Thread view: 
Karl Uppiano - 08 Jul 2007 11:14 GMT
I have a somewhat time-critical application (Java Standard Edition 1.6) that
uses the system time (System.getCurrentTimeMillis) in various forms, such as
creating Date objects initialized to the current time. I don't require high
precision, but I do require reasonable accuracy.

I noticed that my application was two minutes "off time", so I checked the
Windows time and found that it had synced with the NIST time servers a
couple of hours earlier. Windows was on time. How does Java chase platform
time?
Roedy Green - 08 Jul 2007 17:27 GMT
On Sun, 08 Jul 2007 10:14:35 GMT, "Karl Uppiano"
<karl.uppiano@verizon.net> wrote, quoted or indirectly quoted someone
who said :

>I noticed that my application was two minutes "off time", so I checked the
>Windows time and found that it had synced with the NIST time servers a
>couple of hours earlier. Windows was on time. How does Java chase platform
>time?

In DOS and early versions of Windows, Windows kept two times, a more
accurate time of day CMOS clock and a less accurate timer based on
interval ticks every 54.9254 ms  or 18.2065/sec.

Presumably Java would use the CMOS time of day clock.

It will be a native method.  Perhaps you can trace or disassemble it.

How do you know the time was off by two minutes?  Perhaps there is
some problem in your assumptions.

--
Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com
Karl Uppiano - 08 Jul 2007 21:30 GMT
> On Sun, 08 Jul 2007 10:14:35 GMT, "Karl Uppiano"
> <karl.uppiano@verizon.net> wrote, quoted or indirectly quoted someone
[quoted text clipped - 15 lines]
> How do you know the time was off by two minutes?  Perhaps there is
> some problem in your assumptions.

Gagh! Yes, there was a problem in my assumptions. I should never type (or
think) at 03:00 in the AM. It turns out that unbeknownst to me, the personal
firewall on my client machine was blocking the Network Time Protocol, and
the system clock hadn't been successfully synchronized in months. The client
was the one that was off time; the server is just fine. Nothing to see here.
Move along.


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



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