What does the output of return os.lstat(logFile)[ST_CTIME] mean?

alberttresens albert.tresens at gmail.com
Mon Jul 26 13:24:25 EDT 2010


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.




More information about the Python-list mailing list