Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Compare 2 times
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  6 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
loial  
View profile  
 More options Jun 6 2012, 8:50 am
Newsgroups: comp.lang.python
From: loial <jldunn2...@gmail.com>
Date: Wed, 6 Jun 2012 05:50:02 -0700 (PDT)
Local: Wed, Jun 6 2012 8:50 am
Subject: 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
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?


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Alain Ketterlin  
View profile  
 More options Jun 6 2012, 9:29 am
Newsgroups: comp.lang.python
From: Alain Ketterlin <al...@dpt-info.u-strasbg.fr>
Date: Wed, 06 Jun 2012 15:29:37 +0200
Local: Wed, Jun 6 2012 9:29 am
Subject: Re: Compare 2 times

loial <jldunn2...@gmail.com> 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.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Alain Ketterlin  
View profile  
 More options Jun 6 2012, 10:03 am
Newsgroups: comp.lang.python
From: Alain Ketterlin <al...@dpt-info.u-strasbg.fr>
Date: Wed, 06 Jun 2012 16:03:52 +0200
Local: Wed, Jun 6 2012 10:03 am
Subject: Re: Compare 2 times

Alain Ketterlin <al...@dpt-info.u-strasbg.fr> writes:
> loial <jldunn2...@gmail.com> 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.

Sorry, it may happen that the filesystem you're working with provides
that time, in which case it's called birthtime. This _may_ be available
via os.stat().

-- Alain.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Nobody  
View profile  
 More options Jun 6 2012, 2:20 pm
Newsgroups: comp.lang.python
From: Nobody <nob...@nowhere.com>
Date: Wed, 06 Jun 2012 19:20:55 +0100
Local: Wed, Jun 6 2012 2:20 pm
Subject: Re: Compare 2 times

On Wed, 06 Jun 2012 05:50:02 -0700, loial wrote:
> 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?

Most Unix filesystems don't store a "creation" time.

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
t_texas  
View profile  
 More options Jun 6 2012, 11:49 pm
Newsgroups: comp.lang.python
From: t_texas <tyev...@gmail.com>
Date: Wed, 6 Jun 2012 20:49:38 -0700 (PDT)
Local: Wed, Jun 6 2012 11:49 pm
Subject: Re: Compare 2 times
On Jun 6, 7:50 am, loial <jldunn2...@gmail.com> wrote:

> 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?

Unless you are using ext4 you are going to have to store the creation
time yourself.  If the files are coming from your application, use the
sqlite3 or shelve module to store the creation time for each file then
check that data to determine which files are more than 15 minutes old.

If the files are being generated from another application or from
users, have your application check the directory every minute and
record any new files.  Worst case scenario, a file will be present for
16 minutes vs 15.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
garabik-news-2005...@kassiopeia.juls.savba.sk  
View profile  
 More options Jun 10 2012, 2:31 am
Newsgroups: comp.lang.python
From: garabik-news-2005...@kassiopeia.juls.savba.sk
Date: Sun, 10 Jun 2012 06:31:02 +0000 (UTC)
Local: Sun, Jun 10 2012 2:31 am
Subject: Re: Compare 2 times

pyinotify might be worth a look

--
 -----------------------------------------------------------
| Radovan Garabík http://kassiopeia.juls.savba.sk/~garabik/ |
| __..--^^^--..__    garabik @ kassiopeia.juls.savba.sk     |
 -----------------------------------------------------------
Antivirus alert: file .signature infected by signature virus.
Hi! I'm a signature virus! Copy me into your signature file to help me spread!


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »