Linux – How to the modification date of a file be in the future

linuxtimestamp

Whenever I change a file on my (Scientific Linux 6, 64bit) machine, its modification date is set in the future:

bash$ touch new.txt && stat -c %y new.txt && date
2016-09-19 12:33:08.763882267 +0200
Mo 19. Sep 12:30:21 CEST 2016

How can this possibly happen and how can I make the modification dates sane again? It seems as if the difference between the actual time and the modification time is increasing the longer the machine is active.

Best Answer

As confirmed in comments above, you are working with a networked filesystem where the server and client times are not synced. The file is created with a timestamp provided by the server and so it is 3 minutes in the future from the perspective of your workstation. This is easily avoidable if you're running NTP or some other time synchronization system.