Nowadays you can just use ntp daemon. However, I used to use the traditional means to syncing time. This approach was taught to me by Dickson and works on systems other than Ubuntu.
The advantage over the traditional cron tab approach is,
- Less inconsistency in logs for when there are large time corrections.
- A little processing power and memory, but for a modern server this is negligible.
If need be change your time zone,
Next we make sure the time stays correct.
Make ntpdate Scheduled in the chrontab (Scheduled Job):
At this point you will be asked to choose a default editor. I recommend selecting nano if you are a beginner. You can always change the default editor later with, select-editor.
Add to the bottom of the file,
Hit keys, CTRL-O and Enter (save in nano)
Hit keys, CTRL-X (exit in nano)
Next, verify that the crontab was updated successfully by listing the crontab. (Note: you don't need sudo to do this).