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


Groups > comp.lang.python > #71999

os.stat and time zones

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!weretis.net!feeder4.news.weretis.net!rt.uk.eu.org!newsfeed.xs4all.nl!newsfeed2a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <gandalf@shopzeus.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.093
X-Spam-Evidence '*H*': 0.83; '*S*': 0.01; 'true,': 0.05; 'attributes': 0.09; 'converts': 0.09; 'from:charset:iso-8859-2': 0.09; 'question.': 0.14; 'windows': 0.15; '"to': 0.16; 'dependent.': 0.16; 'epoch': 0.16; 'silly': 0.16; 'utc.': 0.16; 'module': 0.19; '(the': 0.22; 'header:User-Agent:1': 0.23; 'resolution': 0.29; 'see,': 0.30; 'file': 0.32; 'says': 0.33; 'subject:time': 0.33; 'something': 0.35; 'but': 0.35; 'example,': 0.37; 'seconds': 0.37; 'operating': 0.37; 'skip:o 20': 0.38; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'system.': 0.39; 'details.': 0.61; 'received:62': 0.63; 'charset:iso-8859-2': 0.64; 'here': 0.66; 'fat': 0.84; 'received:192.168.13': 0.84; 'received:192.168.13.238': 0.84; 'received:62.179': 0.84; 'received:62.179.121': 0.84; 'received:edge03.upcmail.net': 0.84; 'received:upcmail.net': 0.84; 'resolution,': 0.84
X-SourceIP 86.101.30.243
Date Sun, 25 May 2014 13:47:42 +0200
From Nagy László Zsolt <gandalf@shopzeus.com>
User-Agent Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.5.0
MIME-Version 1.0
To python-list@python.org
Subject os.stat and time zones
Content-Type text/plain; charset=ISO-8859-2; format=flowed
Content-Transfer-Encoding 7bit
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.10290.1401018476.18130.python-list@python.org> (permalink)
Lines 24
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1401018476 news.xs4all.nl 2913 [2001:888:2000:d::a6]:60880
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:71999

Show key headers only | View raw


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?

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

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

csiph-web