On Fri, 07 Apr 2006 16:39:40 -0700, jUrner wrote:
Maybe it was not too clear what I was trying to point out.
I have to calculate the time time.time() requires to return the next
tick of the clock.
Should be about 0.01ms but this may differ from os to os.
I suspect that Python isn't quite
Ah, drat -- hit the wrong key and sent the last post before I had finished
writing it... the following is what I *intended* to send.
On Fri, 07 Apr 2006 16:39:40 -0700, jUrner wrote:
Maybe it was not too clear what I was trying to point out.
I have to calculate the time time.time() requires
Steven D'Aprano wrote:
On Fri, 07 Apr 2006 16:39:40 -0700, jUrner wrote:
Maybe it was not too clear what I was trying to point out.
I have to calculate the time time.time() requires to return the next
tick of the clock.
Should be about 0.01ms but this may differ from os to os.
I suspect
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
On Sat, 08 Apr 2006 04:16:20 -0700, jUrner wrote:
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
Steven D'Aprano wrote:
This brings me to an even simpler method of getting the resolution of
time.time(), without the overhead of a while loop:
abs(time.time() - time.time())
1.0013580322265625e-05
which is approximately 0.01ms, just as you expected.
This doesn't necessarily work, at
[jUrner]
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()
Starts getting confusing...
on linux I get
print time.time()
xxx.23
Is it mentioned somewhere that print truncates floats ?
Thats new to me. Kinda surprising that is.
print '%.30' % time.time()
xxx.23456678990...
I knew it must have been hiding somewhere
On windows I'd expect a resolution of
[EMAIL PROTECTED] enlightened us with:
Is it mentioned somewhere that print truncates floats ?
'print' prints str(time()). On the interactive prompt, you see
repr(time()). float.__str__ truncates. I don't know where it's
documented, but this is the reason why you see the truncation.
Sybren
--
Hello all
I have the problem of how to calculate the resolution of the system
clock.
Its now two days of head sratching and still there is nothing more than
these few lines on my huge white sheet of paper stiring at me. Lame I
know.
import time
t1 = time.time()
while True:
t2 = time.time()
Depends iff you are using Linux, print
cat /proc/cpuinfo
and look for the line cpu ...Hz: Parsing that would be
straightforward.
Keep in mind, the time.time() function reports the wall clock time,
which usually has up to a millisecond resolution, regardless of the CPU
speed.
[EMAIL PROTECTED] wrote:
Hello all
I have the problem of how to calculate the resolution of the system
clock.
Its now two days of head sratching and still there is nothing more than
these few lines on my huge white sheet of paper stiring at me. Lame I
know.
import time
t1 = time.time()
Maybe it was not too clear what I was trying to point out.
I have to calculate the time time.time() requires to return the next
tick of the clock.
Should be about 0.01ms but this may differ from os to os.
BTW (I'm new to linux) cat /proc/cpuinfo is nice but I have 2457.60
bogomips.
Is this
13 matches
Mail list logo