time in milliseconds by calling time.time()

scriptlearner at gmail.com scriptlearner at gmail.com
Fri Jul 24 20:39:04 EDT 2009


I am trying to measure some system response time by using the time.time
() or time.clock() in my script.  However, the numbers I get are in
10s of milliseconds.
For example,
1248481670.34   #from time.time()
0.08                   #from time.clock()

That won't work for me, since the response time may be only a few
milliseconds.
My environment is Solaris 10 with Python 2.4.4 (#7, Feb  9 2007,
22:10:21).

SunOS 5.10 Generic_137112-07 i86pc i386 i86pc


The tricky thing is, if I run the python interpreter and import the
time module, I can get a time floating number in better precision by
calling time.time().  Do you guys have any suggestion on debugging
this problem?  Or, is there any other module I can try?  Thanks.

$ python
Python 2.4.4 (#7, Feb  9 2007, 22:10:21)
[GCC 3.4.6] on sunos5
Type "help", "copyright", "credits" or "license" for more information.
>>> import time
>>> time.time()
1248481930.8023829  <--I like this!
>>> time.clock()
0.0
>>>



More information about the Python-list mailing list