• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Check current time on two different Linux Box

 
Ranch Hand
Posts: 10198
3
Mac PPC Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Guys,

Is there a way to check the current time on two different Linux box from a thrid machine? I want to know if the two different Linux Boxes have the same time and if not what is the time difference between the two? I want to check this from a Windows client. Is there a way to do this?
 
author
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Are the boxes running a network time protocol server (ntpd)? If so, you could check via port 123. (http://en.wikipedia.org/wiki/Network_Time_Protocol)

Another way is to run an ssh command to obtain the time. Of course then ssh would have to be open and available.

There are probably several other ways.
 
Saloon Keeper
Posts: 27762
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Actually, rather than checking times, you should just go ahead and synchronize them. As Peter mentioned, Linux comes with NTPD, which can synchronize the system times to a master standard (Tier 1 includes the atomic clocks at NIST) within a dozen milliseconds or so. If you make one or more of the Linux boxes NTP peers, probably even microsecond accuracy, since the main obstacles are network latencies followed (distantly) by CPU overhead. You can also connect your Windows network to a timeserver.
 
Rancher
Posts: 4803
7
Mac OS X VI Editor Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Some Linux distros do not install the NTP client automatically, but its always easy.

Rather than directly contacting one of the first tier servers, you should use one of the many NTP server pools. This cuts load on the tier 1 servers and distributes it over the whole web. See http://www.pool.ntp.org/en/use.html

Once you set it up, the computer will automatically stay in perfect sync.

 
Tim Holloway
Saloon Keeper
Posts: 27762
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Pat Farrell wrote:Some Linux distros do not install the NTP client automatically, but its always easy.

Rather than directly contacting one of the first tier servers, you should use one of the many NTP server pools. This cuts load on the tier 1 servers and distributes it over the whole web. See http://www.pool.ntp.org/en/use.html

Once you set it up, the computer will automatically stay in perfect sync.



Tier 1 should be avoided unless you're, say, Lawrence Livermore labs (who for all I can recall is Tier 1 themselves). Pools are recommended, but if not, use a Tier 2 server. Incidentally, a few years back, a router company hard-wired in a single time server, and unfortunately sold so many of those routers that they basically DDOS'ed it.

Horologists would take exception to "perfect sync". Thanks to various fuzz factors, anyone who's not wired directly into an atomic clock is going to float around the ideal, and even there, things like network environment, temperature, humidity, etc. factor in. What is horology for, if not splitting hairs (or at least seconds )?

Since most of us don't require QUITE that much precision, NTP attempts to make the best of a bad situation. Given multiple time references, it achieves the best consensus it can. It also tunes local drift correction, since they figure that most of us are more interested in using the low-overhead hardware time services of our computers more than we are in computing the precise time to the split nanosecond.
 
Pat Farrell
Rancher
Posts: 4803
7
Mac OS X VI Editor Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Tim Holloway wrote:Thanks to various fuzz factors, anyone who's not wired directly into an atomic clock is going to float around the ideal, and even there, things like network environment, temperature, humidity, etc. factor in. What is horology for, if not splitting hairs (or at least seconds )?



I wonder... suppose you have your own atomic clock. If "you" is not NIS&T, its not official. It might be right, or it might be off a few split hairs. So you need to network your atomic clock to the official time. Once you do that, you have to deal with latency, error retransmission, etc. This raises questions of what is the error induced by link. To address this, you probably will want to setup a network connection to other official times, such as the one in Paris. Pretty soon, you are talking about NTP

For years, I've been running a pool server in my basement. I'm located "inside the beltway" in the Washington DC area, less then 7 miles from the US Naval Observatory, which is one of the official time keepers. I contacted them, and several other similar services near where my server is, and got permission to have my pool server connect directly to the Tier 1 servers. Of course, this just means that the tier 1 servers are in the pool that my server uses, and it used the standard NTP protocols.


 
reply
    Bookmark Topic Watch Topic
  • New Topic