Prev: Builtn super() function. How to use it with multiple inheritance?And why should I use it at all?
Next: Binary compatibility across Python versions?
From: alberttresens on 26 Jul 2010 12:54 Hi, I am trying to get the creation time of a file to be able to correlate it's content timestamps with other log files. In order to get the creation time of the file one a Linux machine i used: return os.lstat(logFile)[ST_CTIME] That returns to me something like: 1279620166 I would like to know the meaning of this number. Is it in seconds since the epoch? Or is some other respresentation? Thanks, Albert -- View this message in context: http://old.nabble.com/What-does-the-output-of-return-os.lstat%28logFile%29-ST_CTIME--mean--tp29268605p29268605.html Sent from the Python - python-list mailing list archive at Nabble.com.
From: alberttresens on 26 Jul 2010 13:24 Hi, thanks for the reply. But what i am more concerned about, as I am trying to correlate logs, is what is the timestamp: 1279620166 mean? Is it seconds since the epoch or the ISO time in seconds? Any idea? Thanks a lot!! Steven D'Aprano-7 wrote: > > On Mon, 26 Jul 2010 09:54:23 -0700, alberttresens wrote: > >> Hi, >> I am trying to get the creation time of a file to be able to correlate >> it's content timestamps with other log files. In order to get the >> creation time of the file one a Linux machine i used: > > You're out of luck. Neither Unix nor Linux store the creation time of > files, at least not on any file system I know of. It stores three > timestamps: mtime, ctime, and atime. > > atime is the simple one -- it is "access time", or when the file was last > read. > > mtime is "modification time" -- it is when the file *contents* were last > changed. > > But ctime is NOT creation time, as many people imagine. It is "change > time", and it changes whenever EITHER the file contents are changed, OR > when the file metadata (permissions, owner, name, etc.) change. > > So any time mtime changes, so does ctime. But not visa versa. > > >> return os.lstat(logFile)[ST_CTIME] >> >> That returns to me something like: 1279620166 >> >> I would like to know the meaning of this number. Is it in seconds since >> the epoch? > > Yes. > > > > > -- > Steven > -- > http://mail.python.org/mailman/listinfo/python-list > > -- View this message in context: http://old.nabble.com/What-does-the-output-of-return-os.lstat%28logFile%29-ST_CTIME--mean--tp29268605p29268871.html Sent from the Python - python-list mailing list archive at Nabble.com.
From: Thomas Jollans on 26 Jul 2010 14:13
On 07/26/2010 07:24 PM, alberttresens wrote: > > Hi, thanks for the reply. Alas, you didn't actually read it: > > But what i am more concerned about, as I am trying to correlate logs, is > what is the timestamp: > 1279620166 mean? > Is it seconds since the epoch or the ISO time in seconds? > > Any idea? > > Thanks a lot!! > [...] >>> I would like to know the meaning of this number. Is it in seconds since >>> the epoch? >> >> Yes. You quoted the answer to your question in the same e-mail. fascinating. A little side note: >> atime is the simple one -- it is "access time", or when the file was >> last read. You should never rely on this, though: some file systems don't store this (I think) and many users/sysadmins actually disable this (mount -o noatime) for performance reasons. (Also, on an SSD, I imagine enabling atime, and with it many, many additional writes, could noticeably detriment disk lifetime) |