Compare 2 times
Jon Clements
joncle at googlemail.com
Wed Jun 6 18:48:40 EDT 2012
On 06/06/12 14:39, Christian Heimes wrote:
> 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
I haven't thought this through too much, but perhaps an ugly
"work-around" would be to use inotify (in some kind of daemon) to watch
for the IN_CREATE events and store the crtime in a personal DB. Then
possibly look at some sort of scheduling to fulfil what happens after 15
minutes.
I'm sure there's subtleties I'm missing, but just thought it could be
useful.
Jon.
More information about the Python-list
mailing list