0

I have two vps (ubuntu 14.04, bought from a provider) and looking at their system time (doing a date) i see 6 minute of difference:

Wed Feb  3 11:57:48 CET 2016
Wed Feb  3 12:03:52 CET 2016

I did a

dpkg-reconfigure tzdata

and checked the timezone is the same. Ntp is not installed. How exactly ubuntu calculate the system time and so how it can happen that there is a difference like that?

EDIT: The question intended to be a bit subtle. I found out my server to be 6 minutes 'late' and this happened without a guessable reason. I become aware of that for I have a software that does its magic only when the system time is maximum 5 minutes wrong with the utc. This software was running perfectly since a lot of time. Suddenly it stopped and i found out that the system time was wrong. Solving the problem was easy. The point is understand why suddenly this could happen.

Sasha Grievus
  • 223
  • 2
  • 11
  • 1
    `ntpdate` comes as standard with Ubuntu, if I am not wrong. Did you try `ntpdate -s ntp.ubuntu.com`? This command sets up time according to Ubuntu NTP server – Incognito Feb 03 '16 at 11:10
  • ah! there it is! So the system time is updated via ntpdate? The question intended to be a bit more subtle. I found out my server to be 6 minutes 'late' and this happened without a guessable reason. I become aware of that for I have a software that do its magic only when the system time is maximum 5 minutes wrong with the utc. This software was running perfectly since a lot of time. Suddenly it stopped and i found out that the system time was wrong. Solving the problem was easy. The point is understand why suddenly this could happen. – Sasha Grievus Feb 03 '16 at 11:18
  • 1
    Oh in that case this will answer you askubuntu.com/questions/138916/why-is-ubuntus-clock-getting-slower-or-faster – Incognito Feb 03 '16 at 11:22
  • 1
    Looks like some one else wrote an answer summarizing it :) – Incognito Feb 03 '16 at 14:47
  • And let's be him, is a good answer, though :) – Sasha Grievus Feb 03 '16 at 16:14

1 Answers1

2

This is called clock drift. The system clock runs a bit faster or slower than it should and over time this accumulates to the difference you see here.

If you want your system time to be accurate, you should definitely install an NTP daemon (the ntp package). It will take into account the specificities of your VPS's clock and adapt the speed so the system time will be as accurate as possible. Contrary to ntpdate, running the NTP daemon never causes your system time to be reset to an earlier time (except during the initial synchronization).

ntpdate, on the other hand, is a "one shot" mechanism. It gets the current time via NTP and simply sets the system time, without slowing down or accelerating the clock. This means that you will continue to experience clock drift after that synchronization.

Oliver
  • 5,973
  • 24
  • 33