[hamster-applet/gnome-2-26] don't round to days, because day concept can mean 8h or 24h. fixes bug 582209



commit 6ecef52c9eb51db56549949973169d3736d3a00e
Author: Toms Bauģis <toms baugis gmail com>
Date:   Mon May 11 19:42:03 2009 +0100

    don't round to days, because day concept can mean 8h or 24h. fixes bug 582209
---
 hamster/stuff.py |   17 +++--------------
 1 files changed, 3 insertions(+), 14 deletions(-)

diff --git a/hamster/stuff.py b/hamster/stuff.py
index b9f3359..c7e344c 100644
--- a/hamster/stuff.py
+++ b/hamster/stuff.py
@@ -68,21 +68,10 @@ class ExpanderColumn(gtk.TreeViewColumn):
 
 
 def format_duration(minutes):
-    if minutes == None:
+    if minutes:
+        return "%02d:%02d" % (minutes / 60, minutes % 60)
+    else:
         return None
-    
-    hours = minutes / 60
-    days = hours / 24
-    hours %= 24
-    minutes = minutes % 60
-    formatted_duration = ""
-    
-    #TODO - convert to list comprehension or that other thing
-    if days > 0:
-        formatted_duration += "%d:" % days
-    formatted_duration += "%02d:%02d" % (hours, minutes)
-            
-    return formatted_duration
 
 def dateDict(date, prefix):
     """converts date into dictionary, having prefix for all the keys"""



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]