Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 0efafb3

Browse files
committed
Rot out all uses of time.milli*().
Slightly improve debug output.
1 parent 605909d commit 0efafb3

1 file changed

Lines changed: 9 additions & 8 deletions

File tree

Demo/sgi/video/Vrec.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -293,15 +293,15 @@ def record(v, info, filename, audiofilename, mono, grey, greybits, \
293293
initaudio(audiofilename, audiostop, audiodone)
294294
gl.wintitle('(rec) ' + filename)
295295
lastid = 0
296-
t0 = time.millitimer()
296+
t0 = time.time()
297297
count = 0
298298
ids = []
299299
v.InitContinuousCapture(info)
300300
while not gl.qtest():
301301
try:
302302
cd, id = v.GetCaptureData()
303303
except sv.error:
304-
#time.millisleep(10) # XXX is this necessary?
304+
#time.sleep(0.010) # XXX is this necessary?
305305
sgi.nap(1) # XXX Try by Jack
306306
continue
307307
ids.append(id)
@@ -322,15 +322,16 @@ def record(v, info, filename, audiofilename, mono, grey, greybits, \
322322
cd.UnlockCaptureData()
323323
if filename:
324324
queue.put((data, int(id*tpf)))
325-
t1 = time.millitimer()
325+
t1 = time.time()
326326
gl.wintitle('(busy) ' + filename)
327-
print lastid, 'fields in', t1-t0, 'msec',
328-
print '--', 0.1 * int(lastid * 10000.0 / (t1-t0)), 'fields/sec'
327+
print lastid, 'fields in', round(t1-t0, 3), 'sec',
328+
print '--', round(lastid/(t1-t0), 1), 'fields/sec'
329329
print 'Captured',count*2, 'fields,',
330-
print 0.1*int(count*20000.0/(t1-t0)), 'f/s',
330+
print round(count*2/(t1-t0), 1), 'f/s',
331331
if lastid:
332-
print count*200.0/lastid, '%,',
333-
print count*rate*200.0/lastid, '% of wanted rate',
332+
print '(',
333+
print round(count*200.0/lastid), '%, or',
334+
print round(count*rate*200.0/lastid), '% of wanted rate )',
334335
print
335336
if ids:
336337
print 'Ids:',

0 commit comments

Comments
 (0)