How can the modification date of a file be in the future?

4

1

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.

Zollern

Posted 2016-09-19T10:36:29.013

Reputation: 43

1Are the files stored on a network share? If so you're seeing the difference in clock sync between the client and server. – chicks – 2016-09-19T18:48:19.940

You are right. The mount is of a network share. Testing on a local mount, the time stamps agree with one another; so the other machine's clock is not synced up. I didn't think of this ... Thanks a lot! – Zollern – 2016-09-19T22:23:58.773

Answers

1

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.

chicks

Posted 2016-09-19T10:36:29.013

Reputation: 280