8

I am performing some experiments on a network of about 10 remote Linux computers which are geographically scattered.

I suspect some of them have clock skews but they are seen transiently (eg. once in a week or twice in a month).

I was wondering if there exists some tools which could detect and quantify such clock skews. Also wondering if clock skew is the right term for what I am witnessing or could it be called clock synchronization.

4 Answers 4

5

Are you trying to keep the clocks synchronized to the right time, or are you trying to determine how accurate the real time clock actually is, without being synchronized?

If you simply want the times to be correct, there's a whole hierarchy of time servers that systems can sync to, and it's often built in to the OS, although you can usually specify time servers. Also, one system can synch to a time server, and then run its own time server for the other systems to sync to.

I have seen, and even used in the past, programs that not only sync to a standard time, but keep up with the local computer's drift from the last synchronization. I used this in the past when we had intermittent internet connections, so the program would correct the time by using the history of expected drift.

Usually, with either of these methods, if the correction is too much, it may assume an error and not do any correction at all.

Hopefully, I'm not totally missing your point. :)

2
  • Thanks. I came across htp: clevervest.com/htp which seems to help synchronize times between machines. However, I am also interested in finding out exactly how many seconds/milliseconds are the various machine's off from a standard reference clock. I would think some standard linux utility would do this and am trying to find one.
    – Ketan
    Jul 2, 2012 at 2:13
  • 2
    NTP is the standard for time sync. There were utilities that calculated the drift years ago; I remember source code for Unix at the time, but I don't remember right now what the names were. Search for time synchronization and correction. Jul 2, 2012 at 2:16
5

Use the NTP-daemon for this.

Define a number of - independent - ntp-servers to contact (ntp.conf, server-directive). 3 servers are good, more are better.

The network-time-protocol will sort out "bad" time sources. Look at the output from ntpq -p after you ran the ntpd for a couple of hours.

You will see which primary server has been chosen, which ones are considered "good" and which ones are considered "bad". The output also contains jitter and latency (offset). These are propably the values you are after...

3

The crony utility has a drift file. See: http://chrony.tuxfamily.org/manual.html#Configuration-options-overview
I do not know the format of that file as I have not yet installed it myself. It does have a command to view the drift info: chronyc sourcestats -v
I plan to install crony on my virtual machines as a start.

This site looks helpful: http://www.markus-gattol.name/ws/time.html

2

For what it's worth, I needed to check the level of skew between two linux systems myself yesterday. Before going digging for tools, I used this unscientific method which gave me good enough results for my purposes (comparing timestamps of log outputs from the two systems).

  1. Launch a Putty session on each system and align them side-by-side
  2. Run the following command on both systems:

    $ while true; do date +%H:%M:%S.%N; done
    
  3. Take a screenshot and compare the last entries on each window.

Might be useful to somebody in a pinch!

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .