John Gordon wrote:
In <023130ef$0$19421$c3e8...@news.astraweb.com> Steven D'Aprano
writes:
if time_difference < 3601:
That's a potential off-by-one error. [...] The right test is:
if time_difference <= 3600:
Aren't those two comparisons the same?
Only if time_difference is an integ
On Mon, 29 Jun 2009 19:15:08 +, John Gordon wrote:
>> > if time_difference < 3601:
>
>> That's a potential off-by-one error. [...] The right test is:
>
>> if time_difference <= 3600:
>
> Aren't those two comparisons the same?
Not if time_difference is a float.
--
http://mail.pyth
In <023130ef$0$19421$c3e8...@news.astraweb.com> Steven D'Aprano
writes:
> > if time_difference < 3601:
> That's a potential off-by-one error. [...] The right test is:
> if time_difference <= 3600:
Aren't those two comparisons the same?
--
John Gordon A is for Amy,
On May 30, 8:49 pm, John Machin wrote:
> > import time
> You are in a maze of twisty little functions, all alike.
Quote of the week. Perhaps the year. I hope you don't mind
me using it in the future.
Geremy Condra
--
http://mail.python.org/mailman/listinfo/python-list
jkv wrote:
Hi Martin,
What i usally do is to convert the two times to seconds since epoch and
compare the two values in seconds. You can use time.mktime to convert
localtime to seconds since epoch.
There's no need to convert - simply retrieve the times as absolute times to
begin with:
fil
On May 31, 10:19 pm, mar...@hvidberg.net wrote:
> >http://en.wikipedia.org/wiki/Subtraction
>
> Only one problem, wise arse:
> TypeError: unsupported operand type(s) for -: 'time.struct_time' and
> 'time.struct_time'
>
> Like I didn't try that...
The point being that you can subtract them in other
>
> http://en.wikipedia.org/wiki/Subtraction
>
Only one problem, wise arse:
TypeError: unsupported operand type(s) for -: 'time.struct_time' and
'time.struct_time'
Like I didn't try that...
--
http://mail.python.org/mailman/listinfo/python-list
On May 30, 11:37 pm, jkv wrote:
> mar...@hvidberg.net wrote:
> > Thanks both
>
> > The first answer is quite instuctive, the other one might be the one
> > I'll use in t
>
> I didn't receive the other answer, could you please forward it to me?> So 2x
> thanks.
>
> You are welcome.
>
> I took anot
On May 30, 4:10 pm, Steven D'Aprano wrote:
> On Sat, 30 May 2009 12:06:55 +0200, jkv wrote:
> > I added a few lines to your script, and now it ought to only print files
> > newer than 3601 seconds (3600 seconds is one hour).
> ...
> > #if file newer than one hour print a line
> > if time_d
On May 31, 7:37 am, jkv wrote:
> mar...@hvidberg.net wrote:
> > Thanks both
>
> > The first answer is quite instuctive, the other one might be the one
> > I'll use in t
>
> I didn't receive the other answer, could you please forward it to me?> So 2x
> thanks.
>
> You are welcome.
>
> I took anoth
On May 30, 7:33 pm, mar...@hvidberg.net wrote:
> I made this little script (below) to look througt a dir to see if
> there are any files newer than .e.g. 1 hour.
> I have the loop through the dir working and can retreive file time as
> well as present time.
> both time variables are in the format r
mar...@hvidberg.net wrote:
> Thanks both
>
> The first answer is quite instuctive, the other one might be the one
> I'll use in t
I didn't receive the other answer, could you please forward it to me?
> So 2x thanks.
You are welcome.
I took another look at your code, and you can compress it all to
On Sat, 30 May 2009 12:06:55 +0200, jkv wrote:
> I added a few lines to your script, and now it ought to only print files
> newer than 3601 seconds (3600 seconds is one hour).
...
> #if file newer than one hour print a line
> if time_difference < 3601:
That's a potential off-by-one erro
Thanks both
The first answer is quite instuctive, the other one might be the one
I'll use in the code, it's nicely compact and clear.
So 2x thanks.
:-) Martin
--
http://mail.python.org/mailman/listinfo/python-list
Hi Martin,
What i usally do is to convert the two times to seconds since epoch and
compare the two values in seconds. You can use time.mktime to convert
localtime to seconds since epoch.
I added a few lines to your script, and now it ought to only print files
newer than 3601 seconds (3600 seconds
I made this little script (below) to look througt a dir to see if
there are any files newer than .e.g. 1 hour.
I have the loop through the dir working and can retreive file time as
well as present time.
both time variables are in the format returned by time.localtime()
My question:
How do I find t
16 matches
Mail list logo