What does the output of return os.lstat(logFile)[ST_CTIME] mean?
Steven D'Aprano
steve at REMOVE-THIS-cybersource.com.au
Mon Jul 26 13:15:13 EDT 2010
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
More information about the Python-list
mailing list