[gnome-clocks] Sunrise and sunset should be shown in the time local to the city



commit 5a2b0dfceca09f0d666faad24caa6d1ec7c0e292
Author: Paolo Borelli <pborelli gnome org>
Date:   Mon Sep 2 22:02:44 2013 +0200

    Sunrise and sunset should be shown in the time local to the city
    
    This has also the side effect of properly showing those times in RTL
    locales and respecting AM/PM since we now take care of the formatting.

 src/world.vala |   16 ++++++++++++++--
 1 files changed, 14 insertions(+), 2 deletions(-)
---
diff --git a/src/world.vala b/src/world.vala
index 1607036..80e73ee 100644
--- a/src/world.vala
+++ b/src/world.vala
@@ -67,13 +67,25 @@ private class Item : Object, ContentItem {
 
     public string sunrise_label {
         owned get {
-            return weather_info.get_sunrise ();
+            ulong sunrise;
+            if (!weather_info.get_value_sunrise (out sunrise)) {
+                return "-";
+            }
+            var sunrise_time = new GLib.DateTime.from_unix_local (sunrise);
+            sunrise_time = sunrise_time.to_timezone (time_zone);
+            return Utils.WallClock.get_default ().format_time (sunrise_time);
         }
     }
 
     public string sunset_label {
         owned get {
-            return weather_info.get_sunset ();
+            ulong sunset;
+            if (!weather_info.get_value_sunset (out sunset)) {
+                return "-";
+            }
+            var sunset_time = new GLib.DateTime.from_unix_local (sunset);
+            sunset_time = sunset_time.to_timezone (time_zone);
+            return Utils.WallClock.get_default ().format_time (sunset_time);
         }
     }
 


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