Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have ntpd running on a box. I want to see how the time on the box compares to the time retrieved from ntp.ubuntu.com. Is there an easy way to do this?

share|improve this question
    
I take it you just want to see the time there and not actually change your computer's time to match it? – DerfK Jan 10 '11 at 20:37
    
Yep, that's right. – John Bachir Jan 10 '11 at 20:50
up vote 14 down vote accepted

ntpq -p ntp.ubuntu.com

From man ntpq:

...
-p     Print  a list of the peers known to the server as well as a summary of their state. This is equivalent to the peers interactive command.
...

Edit: The host is timing out right now. ntpq -p pool.ntp.org will return a valid result.

share|improve this answer
2  
ntpdate is deprecated so it's best to get in habit of using ntpq instead. However I still use ntpdate all the time myself, old habits die hard. – Phil Hollenback Jan 10 '11 at 20:43
    
@Phil Hollenback : ntpdate may be "deprecated", but it works. ntpq -p often does not. Possibly because ISPs are blocking it? Or because of the server configuration? – mivk Jan 2 at 23:54
1  
@mivk "Possibly because ISPs are blocking it" This makes no sense. It's all the same NTP protocol. – Jonathon Reinhart Jan 13 at 15:06
1  
@mivk @Jonathon actually, ntpq -p is not asking for time, it's asking for a list of peers and other vars. If the server has a noquery restriction it will timeout. – GnP Apr 21 at 19:10

You can use ntpdate to query a time server

ntpdate -q ntp.ubuntu.com

share|improve this answer
    
Thanks! Maybe you can answer this question too serverfault.com/questions/220836/… – John Bachir Jan 10 '11 at 20:48

Actually, the command ntpq -c "rv 0 clock" ntp.ubuntu.com will return the time of the server in standard format : this is the result from ca.pool.ntp.org :

clock=d1b5aa9c.b8f9697a  Wed, Jun 29 2011  9:43:56.722
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.