[gnome-clocks] Don't try parsing libgweather strings



commit 90b352e08e39edfd59094a775a564097c3f00a94
Author: Giovanni Campagna <gcampagna src gnome org>
Date:   Sun Aug 26 18:42:08 2012 +0200

    Don't try parsing libgweather strings
    
    The output of gweather_info_get_sunrise/sunset() is localized. Instead,
    use gweather_info_get_value_sunrise/get_value_sunset(), which gives directly
    the time as a unix timestamp.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=682735

 gnomeclocks/widgets.py |   10 ++++------
 1 files changed, 4 insertions(+), 6 deletions(-)
---
diff --git a/gnomeclocks/widgets.py b/gnomeclocks/widgets.py
index 17e451b..08eccb9 100644
--- a/gnomeclocks/widgets.py
+++ b/gnomeclocks/widgets.py
@@ -169,14 +169,12 @@ class DigitalClock():
         
     def weather_updated_callback(self, weather):
         # returned as the time here
-        sunrise = weather.get_sunrise()
-        sunset = weather.get_sunset()
+        ok, sunrise = weather.get_value_sunrise()
+        ok, sunset = weather.get_value_sunset()
         self._last_sunrise = self.sunrise
         self._last_sunset = self.sunset
-        self.sunrise = self.get_local_time(
-                        time.mktime(time.strptime("1970"+sunrise, "%Y%H:%M")))
-        self.sunset = self.get_local_time(
-                        time.mktime(time.strptime("1970"+sunset, "%Y%H:%M")))
+        self.sunrise = self.get_local_time(sunrise)
+        self.sunset = self.get_local_time(sunset)
         self.update()
 
     def get_pixbuf(self):



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