Compare 2 times

Christian Heimes lists at cheimes.de
Wed Jun 6 15:39:14 CEST 2012


Am 06.06.2012 14:50, schrieb loial:
> I have a requirement to test the creation time of a file with the
> current time and raise a message if the file is  more than 15 minutes
> old.
> 
> Platform is Unix.
> 
> I have looked at using os.path.getctime for the file creation time and
> time.time() for the current time, but is this the best approach?

Lots of people are confused by ctime because they think 'c' stands for
change. That's wrong. st_ctime is status change time. The ctime is
updated when you change (for example) owner or group of a file, create a
hard link etc. POSIX has no concept of creation time stamp.

Christian




More information about the Python-list mailing list