changeset 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 36cb40c51a5e
children a048066bd20f
files python/utils.py
diffstat 1 files changed, 5 insertions(+), 4 deletions(-) [+]
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'