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


Groups > comp.lang.python > #72049

Re: os.stat and time zones

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.albasani.net!rt.uk.eu.org!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.041
X-Spam-Evidence '*H*': 0.92; '*S*': 0.00; 'true,': 0.05; 'attributes': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'missed': 0.12; 'question.': 0.14; 'windows': 0.15; 'dependent.': 0.16; 'epoch': 0.16; 'filesystem': 0.16; 'finney': 0.16; 'means:': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'silly': 0.16; 'utc.': 0.16; 'module': 0.19; 'header:User- Agent:1': 0.23; 'changes,': 0.26; 'header:X-Complaints-To:1': 0.27; 'resolution': 0.29; "doesn't": 0.30; 'see,': 0.30; 'writes:': 0.31; 'file': 0.32; 'quite': 0.32; 'says': 0.33; 'implemented': 0.33; 'subject:time': 0.33; 'something': 0.35; 'but': 0.35; 'example,': 0.37; 'seconds': 0.37; 'so,': 0.37; 'operating': 0.37; 'skip:o 20': 0.38; 'ben': 0.38; 'to:addr :python-list': 0.38; 'to:addr:python.org': 0.39; 'system.': 0.39; 'received:org': 0.40; 'read': 0.60; 'details.': 0.61; "you've": 0.63; 'different': 0.65; 'skip:\xe2 10': 0.65; 'worth': 0.66; 'here': 0.66; 'money': 0.72; '8bit%:27': 0.74; 'million': 0.74; 'sale': 0.75; '8bit%:46': 0.78; 'fat': 0.84; 'nagy': 0.84; 'received:125': 0.84; 'resolution,': 0.84; '\xe2\x80\x9cthe': 0.91
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From Ben Finney <ben@benfinney.id.au>
Subject Re: os.stat and time zones
Date Mon, 26 May 2014 13:33:09 +1000
References <5381D85E.8010502@shopzeus.com>
Mime-Version 1.0
Content-Type text/plain; charset=utf-8
Content-Transfer-Encoding 8bit
X-Gmane-NNTP-Posting-Host jigong.madmonks.org
X-Public-Key-ID 0xAC128405
X-Public-Key-Fingerprint 517C F14B B2F3 98B0 CB35 4855 B8B2 4C06 AC12 8405
X-Public-Key-URL http://www.benfinney.id.au/contact/bfinney-pubkey.asc
X-Post-From Ben Finney <bignose+hates-spam@benfinney.id.au>
User-Agent Gnus/5.13 (Gnus v5.13) Emacs/23.4 (gnu/linux)
Cancel-Lock sha1:qncedTPWojpjtWOSZEo4Sm6HWxA=
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.10331.1401075206.18130.python-list@python.org> (permalink)
Lines 52
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1401075206 news.xs4all.nl 2899 [2001:888:2000:d::a6]:59827
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:72049

Show key headers only | View raw


Nagy László Zsolt <gandalf@shopzeus.com> writes:

> 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.

It says what it means: “The exact meaning and resolution of the
st_atime, st_mtime, and st_ctime attributes depend on the operating
system and the file system.”

That doesn't mean quite what you've said in your paraphrase.

> But here is something interesting. Supposedly, os.stat(fpath).st_mtime
> and os.path.getmtime(path) return the same thing.

The implementation of ‘os’ is platform-dependent. So, the meaning of the
return value of ‘os.stat’ and of ‘os.path.getmtime’ will also be
platform-dependent.

> If the above are true, then as far as I can see, the meaning of
> st_mtime is NOT platform dependent.

You've missed the part where the ‘os’ module is platform-dependent, and
hence the ‘os.stat’ behaviour is platform-dependent.

> It always means the number of seconds elapsed since the epoch in UTC.

The time elapsed doesn't change in meaning. The meaning of “modification
time” (and “creation time”, and “access time”) is what changes, because
different filesystems and different operating systems have different
meanings for those.

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

Read up on the different filesystems implemented on the operating
systems and filesystems relevant to you, and what meanings are assigned
by each specific filesystem to those timestamps.

-- 
 \       Moriarty: “Forty thousand million billion dollars? That money |
  `\            must be worth a fortune!” —The Goon Show, _The Sale of |
_o__)                                                       Manhattan_ |
Ben Finney

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


Thread

Re: os.stat and time zones Ben Finney <ben@benfinney.id.au> - 2014-05-26 13:33 +1000

csiph-web