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

Is it possible to use ntpd to log all time resets and adjustments rather than set system clock?

share|improve this question
It's not clear what you are trying to do. What would reset or adjust the time exactly? – David Schwartz Apr 12 '12 at 7:34
up vote 0 down vote accepted

From a look at the ntpd man page this doesn't look possible. It does save out stats of what it is receiving but it will always try to set the time. You could in theory hack out those system calls but that sounds dangerous/over the top.

If you just want to get what the time differences were, you could look at running ntpdate with the query switch -q. Try it and see whether it is spitting out the right info for your purposes. From the manpage:

-q Query only - don't set the clock.

Or there is the debug switch -d which may print out more info that you need.

share|improve this answer
It seems this can work, but it will provide less accuracy than running ntpd continuously. – user626528 Apr 12 '12 at 9:48
I think you're only other options would be to hack ntpd to pieces to remove the sections of code that change the time. i.e. comment out the time setting call and recompile the code. This would be messy. What exactly are you trying to achieve that requires not setting the time? We may be able to suggest a better solution. – webtoe Apr 12 '12 at 9:55
I need to have precise time in my program, but I can't change system time as program doesn't have such rights. The system doesn't have ntpd installed, because this is Windows. – user626528 Apr 12 '12 at 9:58
Right, well you asked about ntpd in your question and didn't say that you were running windows. I suggest you update your question. Your program doesn't need to have the permissions. The Windows Time Service (or ntpd on linux) can keep your system's clock accurate. Then in your program, just query the system time. This is how you solve this problem. – webtoe Apr 12 '12 at 10:15
Windows Time Service is not any accurate. It has error of +- several seconds, what is completely not acceptable. – user626528 Apr 12 '12 at 10:26

Your Answer


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.