Mercurial Hosting > traffic-intelligence
diff python/utils.py @ 261:4aa792cb0fa9
changing framesToTime to return a datetime.time
author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
---|---|
date | Wed, 25 Jul 2012 18:02:36 -0400 |
parents | 571ba5ed22e2 |
children | a048066bd20f |
line wrap: on
line diff
--- a/python/utils.py Tue Jul 24 18:07:23 2012 -0400 +++ b/python/utils.py Wed Jul 25 18:02:36 2012 -0400 @@ -167,12 +167,13 @@ def framesToTime(nFrames, frameRate, initialTime = (0.,0.,0.)): 'returns hour, minutes and seconds' from math import floor - seconds = floor(float(nFrames)/float(frameRate)) - h = floor(seconds/3600.) + from datetime import time + seconds = int(floor(float(nFrames)/float(frameRate))) + h = int(floor(seconds/3600.)) seconds = seconds - h*3600 - m = floor(seconds/60) + m = int(floor(seconds/60)) seconds = seconds - m*60 - return (h+initialTime[0], m+initialTime[1], seconds+initialTime[2]) + return time(h+int(initialTime[0]), m+int(initialTime[1]), seconds+int(initialTime[2])) def sortXY(X,Y): 'returns the sorted (x, Y(x)) sorted on X'