]> git.itanic.dy.fi Git - emerge-timer/commitdiff
Use float number when dealing with the time simplification
authorEsko Kokkonen <esko.kokkonen@gmail.com>
Sun, 18 Dec 2011 12:09:15 +0000 (14:09 +0200)
committerEsko Kokkonen <esko.kokkonen@gmail.com>
Sun, 18 Dec 2011 12:09:15 +0000 (14:09 +0200)
This could bug out if you would give an int to the function, in which
case it wouldn't return correct results

emerge-timer.py

index bfdb5370b932674d3ec51afb93c5b4cad4e2b645..e1d1ec5d3582d889638c1bba7ffd04c31eef4dc5 100755 (executable)
@@ -183,10 +183,10 @@ def give_time(time, nocolor=False):
         return(green_start + "unknown" + color_stop)
 
 
-    days = time/(3600*24)
-    hours = (days - int(days))*24
-    minutes = (hours - int(hours))*60
-    seconds = (minutes - int(minutes))*60
+    days = time/(3600.0*24.0)
+    hours = (days - int(days))*24.0
+    minutes = (hours - int(hours))*60.0
+    seconds = (minutes - int(minutes))*60.0
 
     days = int(days)
     hours = int(hours)