0

I'm trying to do adjtime to adjust the clock (which is, for example, 15 mins in future) supplying correct offset to adjtime function. But as I understand adjtime does it very slowly. So when I actually call the function and then check the time it remains the same.

How can I make a small adjustements (e.g. 1s to 1hr) so that effect appears immediately?

Thanks.

maverik
  • 5,508
  • 3
  • 35
  • 55

1 Answers1

4

The whole point of adjtime is to do so gradually and continuously in a way that does not break running applications which expect time to be continuous (and more importantly, monotone). If you use it correctly (e.g. via ntp), your clock should never drift by enough to require large adjustments like 15 minutes.

If you really do want to do a one-time large adjustment, use clock_settime. Just be aware that it could cause running applications to misbehave.

R.. GitHub STOP HELPING ICE
  • 208,859
  • 35
  • 376
  • 711
  • 1
    @maverik If you use adjtime correctly and often enough, it will have an effect similar to adjusting the frequency. – Jonas Schäfer Aug 05 '14 at 17:21
  • @JonasWielicki: Adjustement for 15 minutes takes way looong. I don't need adjusted time after 3 days, I need it now (in 1-2 secs). – maverik Aug 05 '14 at 17:23
  • 2
    @maverik: Then it sounds like you need to use `clock_settime`. But be aware that that could adversely affect other applications running on the system. If you run `ntpd` and have it properly configured, your system should maintain the correct time automatically. – Keith Thompson Aug 05 '14 at 18:18