def calc_time_res():
    now = time.time
    start = now()
    x = start
    while start == x:
        x = now()
    print x, start  # <--
    print x - start

print calc_time_res()
>> 1.50203704834e-05

Something is going wrong here.
If you look at the function ,time.time() returns time in microseconds
(most oses and so
does mine).
So the calculation goes, lets say 1.23 - 1.24
How can the result be something like 1.50203704834e-05 ?
I would expect 0.01.

Next is, the first print statement prints out x and start equal up to
the fraction.

Is it Python giggeling?
Maybe it's python throwing the rounded float at us but internally
keeps calculating with the float returned by the os.
Maybe I'm wrong.

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to