File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Threads and Synchronization and the fly likes time sync Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Threads and Synchronization
Bookmark "time sync " Watch "time sync " New topic

time sync

Alex Balatibat

Joined: Oct 06, 2012
Posts: 1
Hi everyone! I do have a problem regarding time synchronization. The problem is given n clocks c1, c2, ..., cn, with respective time readings t1, t2, ..., tn, the theoretical solution to the time synchronization problem is when the n clocks provide only one exact time t0 at any given time. However, due to the variabilities inherrent to the n clocks, we can accept a practical solution of an average time t0 with a variance σ. The variance could be set to the desired resolution, e.g., 1ms. Given the above scenario, the Berkeley algorithm provides a way to compute for the average time t0 using the different time readings t1, t2, ..., tn. That is simply, t0 = (t1 + t2 + ...+ tn) × n-1. Given the situation how can i discover the node in the network and assign assume one node that it is the server where all the time will be sync to the other client node. Hope you can help me. Thanks a lot.

Jelle Klap

Joined: Mar 10, 2008
Posts: 1951

Wouldn't it be simpler to just use the NTP implementation of the operating system to sync with a predetermined set of clock sources?

Build a man a fire, and he'll be warm for a day. Set a man on fire, and he'll be warm for the rest of his life.
Ranganathan Kaliyur Mannar

Joined: Oct 16, 2003
Posts: 1101

and, Welcome to the Ranch!

I agree. Here's the link:
subject: time sync
It's not a secret anymore!