Help with time

Marc Poulin mpoulin at verinet.com
Fri Feb 1 10:35:15 EST 2002


In article <a3ecqt$16bk9d$1 at ID-98166.news.dfncis.de>, "MDK" <mdk at mdk.com>
wrote:

> I am passing to a function how long in milliseconds I want to wait for

> import time
> 
> def getdata(ms):
>     starttime = time.time()
>     while len(data) < 20:
>         now = time.time()
>         print '%.3f seconds %.3f' % (now - starttime, timeout / 1000) if
>         now - starttime > timeout/1000:
>             break
>     return data
> 
> What am I doing wrong?

Maybe a truncation problem (mixing ints and floats)?

My Python interpreter says
>>> print 100/1000
0
>>> print 100/1000.0
0.1
>>>



More information about the Python-list mailing list