Re: Compare 2 times



loial <jldunn2000@xxxxxxxxx> writes:

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?

No. getctime() returns the last "change" time. The creation time is not
kept anywhere. This may still match your requirement though. And os.path
is the right package to look at for such tasks.

-- Alain.
.



Relevant Pages

  • Re: Compare 2 times
    ... current time and raise a message if the file is more than 15 minutes ... Platform is Unix. ... The creation time is not ...
    (comp.lang.python)
  • Re: Compare 2 times
    ... Platform is Unix. ... Unless you are using ext4 you are going to have to store the creation ... sqlite3 or shelve module to store the creation time for each file then ...
    (comp.lang.python)
  • Re: Compare 2 times
    ... 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 ... Most Unix filesystems don't store a "creation" time. ...
    (comp.lang.python)
  • Compare 2 times
    ... 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 ... Platform is Unix. ...
    (comp.lang.python)
  • Re: Get age of a file/dir
    ... Python has a builtin module called "stat" which ... includes ST_ATIME, ST_MTIME, ST_CTIME members which are times accessed, ... However this only gets creation time on Windows, on Unix it gets the the ...
    (comp.lang.python)