Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

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 want to know the time on a server accurate to the millisecond.

there's this way:

local $ ssh user@servername
Welcome to server!
server $ date
Fri Feb 18 11:27:50 EST 2011

But I need more accuracy. Is there a command that will be more precise?

share|improve this question
Network latency alone will prohibit true millisecond accuracy. – Zan Lynx Feb 18 '11 at 21:34
up vote 20 down vote accepted

Check " man date ". You can let it display you the hours, minutes, seconds and nanoseconds with

date +%H:%M:%S.%N

See the output of

while : ; do date +%H:%M:%S.%N ; done

interrupt the infinite while loop with CTRL+C .

If you want less decimal places you could do

while : ; do date +%H:%M:%S.%N | cut -c 1-12 ; done

Increase or decrease the output length changing the "12" on "-c 1-12" after cut.

share|improve this answer

No commands that I am aware of, but you can call gettimeofday to get results accurate to the millisecond. There are compilable examples on StackOverflow, CTT's in particular would be of interest.

share|improve this answer

You must log in to answer this question.

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