Is time.time() < time.time() always true?

AndyR newshound at incanberra.com.au
Tue Nov 21 22:26:04 EST 2006


Hi all:

>From my experience with os's.
Time is updated at intervals- they may be as low as 1mS See . So for that 
millisecond multiple readings of the time will always return the same 
result. Therefore time.time() < time.time() will be false for most readings.

However the result could be true if you catch the exact time when the os 
updates its clock. It will only be True for a single execution of the line 
and you will have to be lucky to catch it at just the right time.

Of course if you hard loop over the interval its possible to see the 
transition.

for x in xrange (10000):
    t = time.time()
    if t < time.time:
        print "transition at ",  t

Enjoy.
Andy

"Ben Finney" <bignose+hates-spam at benfinney.id.au> wrote in message 
news:mailman.568.1164159352.32031.python-list at python.org...
> Gabriel Genellina <gagsl-py at yahoo.com.ar> writes:
>
>> The only thing Python can guarantee, is that the left expression is
>> evaluated before the right one (5.13 Evaluation order, Language
>> Reference).
>
> Thanks, that answers my question asked elsewhere.
>
> -- 
> \          "One thing vampire children have to be taught early on is, |
>  `\                   don't run with a wooden stake."  -- Jack Handey |
> _o__)                                                                  |
> Ben Finney
> 





More information about the Python-list mailing list