[hamster-applet] handle the delta and the date properly



commit c604247d09dd68d2e8c97a3f8dd7bdab38dda669
Author: Toms Bauģis <toms baugis gmail com>
Date:   Fri Jan 29 16:16:30 2010 +0000

    handle the delta and the date properly

 src/hamster/hamsterdbus.py |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
---
diff --git a/src/hamster/hamsterdbus.py b/src/hamster/hamsterdbus.py
index 9f43eca..1621b4d 100644
--- a/src/hamster/hamsterdbus.py
+++ b/src/hamster/hamsterdbus.py
@@ -63,8 +63,10 @@ class HamsterDbusController(dbus.service.Object):
                 fact[key] = ''
 
             # convert times to gmtime
-            if isinstance(fact[key], datetime.datetime):
+            if isinstance(fact[key], datetime.datetime) or isinstance(fact[key], datetime.date):
                 fact[key] = timegm(fact[key].timetuple())
+            elif isinstance(fact[key], datetime.timedelta) :
+                fact[key] = fact[key].days * 24 * 60 * 60 + fact[key].seconds
 
         return fact
 



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