I was trying to build source files on a remote server using make. The make command would sometimes throw up a clock skew warning like this:
make: Warning: File `foobar.cpp' has modification time 36 s in the future make: warning: Clock skew detected. Your build may be incomplete
It turns out that these source files were actually shared from another computer to this remote server using NFS. Using the date command at the local computer and the remote server, I found that there was a difference of a few seconds between the two.
More investigation showed that only the local computer was using NTP and so its time was correct. The remote server was not using NTP and so its time was wrong.
To install and enable NTP on the remote server, I used these commands:
$ sudo apt install ntp $ sudo service ntp reload
Note that it takes a few minutes for the synchronized correct time to show up on the computer after these commands. After the sync, I no longer get the clock skew warnings from make.
Reference: Time Synchronisation with NTP
Tried with: Ubuntu 16.04