Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #71999 > unrolled thread

os.stat and time zones

Started byNagy László Zsolt <gandalf@shopzeus.com>
First post2014-05-25 13:47 +0200
Last post2014-05-25 13:47 +0200
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python


Contents

  os.stat and time zones Nagy László Zsolt <gandalf@shopzeus.com> - 2014-05-25 13:47 +0200

#71999 — os.stat and time zones

FromNagy László Zsolt <gandalf@shopzeus.com>
Date2014-05-25 13:47 +0200
Subjectos.stat and time zones
Message-ID<mailman.10290.1401018476.18130.python-list@python.org>
This might be a silly question. Documentation of os.stat:

> The exact meaning and resolution of the st_atime, st_mtime, and 
> st_ctime attributes depend on the operating system and the file 
> system. For example, on Windows systems using the FAT or FAT32 file 
> systems, st_mtime has 2-second resolution, and st_atime has only 1-day 
> resolution. See your operating system documentation for details.
So it says that the meaning is platform dependent.

But here is something interesting. Supposedly, os.stat(fpath).st_mtime 
and os.path.getmtime(path) return the same thing. The documentation of 
os.path.getmtime says that it "returns the number of seconds since the 
epoch". And the time module says that "To find out what the epoch is, 
look at gmtime(0)". And the documentation of gmtime says that it 
converts the given value to a struct_time *that is in UTC*.

If the above are true, then as far as I can see, the meaning of st_mtime 
is NOT platform dependent. It always means the number of seconds elapsed 
since the epoch in UTC. (The resolution can be platform dependent, I 
admit that.)

So what is the truth? What other difference can be in the meaning that 
is platform dependent?

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web