If I touch a new file, I see that its modification time is showing as the current time in my local time-zone rather than in UTC. If I were to copy that file to a machine that's in another time-zone, would it update to that machine's time-zone or would it still show the same time it showed on my machine? Do file modification times contain time-zone information?

  • I have answered the first bit, but don't grok the last bit -- "Do file modification times contain time zone information?". – ctrl-alt-delor Apr 22 '20 at 6:52
  • @ctrl-alt-delor What I believe this means is "When the timestamp is written, does the OS write it in such a way that the timezone is taken into account". The answer to this is that most Unix systems uses UTC as the system clock and timezone offsets are only applied when displaying time... But not knowing much about file system implementations, I would not feel comfortable saying that I know I'm right. I think this is basically a question about how TZ data is handled on a generic Unix system. – Kusalananda Apr 22 '20 at 6:57
  • @Kusalananda While I (usually) hate it when someone else tries to clarify for the OP. In this case I think you are correct. I just did not read it properly. I have just edited to make it easier to read (no change in meaning). – ctrl-alt-delor Apr 22 '20 at 7:03
  • @ctrl-alt-delor Oops, sorry. – Kusalananda Apr 22 '20 at 7:13
  • @Kusalananda It is OK. I said you did a good job of making it clear. (but often people just choose one interpretation of the ambiguity). – ctrl-alt-delor Apr 22 '20 at 9:14

They should be in Unix time: Seconds since 1970-01-01T00:00 UTC. If you move it then it will be the same time. However time is displayed in local time.

The above is true on Unix file-systems. On at least some Microsoft file-systems the time is stored in local time (for backward compatibility with MS operating systems).

  • 1
    ... on Unix-style file systems ;-). – Stephen Kitt Apr 22 '20 at 6:55
  • That isn't true at all for the nowadays widely-used NTFS. Whereas, conversely, it is the case for filesystems that one will use on Unix and Linux systems, such as UDF and ISO 9660. The world does not divide up into "Microsoft" and "Unix" as you think. – JdeBP Apr 22 '20 at 8:50
  • @JdeBP It is partly true then (you said not at all true). I would edit the question, but I don't fully understand your comment. – ctrl-alt-delor Apr 22 '20 at 9:18
  • 1
    @JdeBP Which part isn't true? – user779159 Apr 22 '20 at 12:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.