Update to 3.36.2

This commit is contained in:
Kalev Lember 2020-05-10 17:12:52 +02:00
parent ea80e2c8d5
commit fddca577c2
4 changed files with 7 additions and 216 deletions

1
.gitignore vendored
View File

@ -58,3 +58,4 @@
/gnome-clocks-3.33.1.tar.xz
/gnome-clocks-3.34.0.tar.xz
/gnome-clocks-3.36.0.tar.xz
/gnome-clocks-3.36.2.tar.xz

View File

@ -1,17 +1,14 @@
%global libgweather_version 3.32.0
Name: gnome-clocks
Version: 3.36.0
Release: 2%{?dist}
Version: 3.36.2
Release: 1%{?dist}
Summary: Clock application designed for GNOME 3
License: GPLv2+
URL: https://wiki.gnome.org/Apps/Clocks
Source0: https://download.gnome.org/sources/gnome-clocks/3.36/%{name}-%{version}.tar.xz
# https://gitlab.gnome.org/GNOME/gnome-clocks/-/issues/91
Patch0: null-datetime-crash.patch
BuildRequires: meson
BuildRequires: desktop-file-utils
BuildRequires: gettext
@ -63,6 +60,9 @@ desktop-file-validate $RPM_BUILD_ROOT%{_datadir}/applications/org.gnome.clocks.d
%{_datadir}/metainfo/org.gnome.clocks.metainfo.xml
%changelog
* Sun May 10 2020 Kalev Lember <klember@redhat.com> - 3.36.2-1
- Update to 3.36.2
* Tue Apr 14 2020 Michael Catanzaro <mcatanzaro@gnome.org> - 3.36.0-2
- Fix crashes when sunrise/sunset calculation goes badly

View File

@ -1,210 +0,0 @@
From db85dd563e1adbbb697acffc25e2c22eac1bbb32 Mon Sep 17 00:00:00 2001
From: Zander Brown <zbrown@gnome.org>
Date: Fri, 10 Apr 2020 15:16:03 +0100
Subject: [PATCH] world: handle null datetime
Of course we need to figure out how we got garbage that generated a null
datetime but at least this way we don't crash (and get logs)
(Kinda) Fix https://gitlab.gnome.org/GNOME/gnome-clocks/-/issues/91
---
src/world.vala | 169 +++++++++++++++++++++++++++++--------------------
1 file changed, 99 insertions(+), 70 deletions(-)
diff --git a/src/world.vala b/src/world.vala
index 0da51bf..c212b02 100644
--- a/src/world.vala
+++ b/src/world.vala
@@ -251,90 +251,119 @@ public class Item : Object, ContentItem {
tick ();
}
- private void calculate_riseset () {
- double lat, lon;
- int y, m, d;
+ private void calculate_riseset_at_correction (double latitude,
+ double longitude,
+ int year,
+ int month,
+ int day,
+ double correction,
+ out DateTime sunrise,
+ out DateTime sunset) {
int rise_hour, rise_min;
int set_hour, set_min;
+ calculate_sunrise_sunset (latitude,
+ longitude,
+ year,
+ month,
+ day,
+ correction,
+ out rise_hour,
+ out rise_min,
+ out set_hour,
+ out set_min);
+
+ var utc_sunrise = new DateTime.utc (year, month, day, rise_hour, rise_min, 0);
+ if (utc_sunrise != null) {
+ sunrise = utc_sunrise.to_timezone (time_zone);
+ } else {
+ sunrise = null;
+ warning ("Sunrise for (%f,%f) resulted in %04i-%02i-%02i %02i:%02i",
+ latitude,
+ longitude,
+ year,
+ month,
+ day,
+ rise_hour,
+ rise_min);
+ }
+
+ var utc_sunset = new DateTime.utc (year, month, day, set_hour, set_min, 0);
+ if (utc_sunset != null) {
+ var local_sunset = utc_sunset.to_timezone (time_zone);
+ if (local_sunset.compare (sun_rise) < 0) {
+ sunset = local_sunset.add_days (1);
+ } else {
+ sunset = local_sunset;
+ }
+ } else {
+ sunset = null;
+ warning ("Sunset for (%f,%f) resulted in %04i-%02i-%02i %02i:%02i",
+ latitude,
+ longitude,
+ year,
+ month,
+ day,
+ rise_hour,
+ rise_min);
+ }
+ }
+
+ private void calculate_riseset () {
+ // Where we are calculating for
+ double latitude, longitude;
+ // The current UTC day
+ int year, month, day;
+
if (date_time.get_day_of_year () == last_calc_day) {
return;
}
- location.get_coords (out lat, out lon);
+ location.get_coords (out latitude, out longitude);
// Some locations, such as UTC, aren't actual locations and don't have
// proper coords
- if (!lat.is_finite () || !lon.is_finite ()) {
+ if (!latitude.is_finite () || !longitude.is_finite ()) {
return;
}
var utc = date_time.to_utc ();
- utc.get_ymd (out y, out m, out d);
-
- calculate_sunrise_sunset (lat,
- lon,
- y,
- m,
- d,
- RISESET_CORRECTION_NONE,
- out rise_hour,
- out rise_min,
- out set_hour,
- out set_min);
-
- sun_rise = new DateTime.utc (y, m, d, rise_hour, rise_min, 0).to_timezone (time_zone);
- sun_set = new DateTime.utc (y, m, d, set_hour, set_min, 0).to_timezone (time_zone);
- if (sun_set.compare (sun_rise) < 0)
- sun_set = sun_set.add_days (1);
-
- calculate_sunrise_sunset (lat,
- lon,
- y,
- m,
- d,
- RISESET_CORRECTION_CIVIL,
- out rise_hour,
- out rise_min,
- out set_hour,
- out set_min);
-
- civil_rise = new DateTime.utc (y, m, d, rise_hour, rise_min, 0).to_timezone (time_zone);
- civil_set = new DateTime.utc (y, m, d, set_hour, set_min, 0).to_timezone (time_zone);
- if (civil_set.compare (civil_rise) < 0)
- civil_set = civil_set.add_days (1);
-
- calculate_sunrise_sunset (lat,
- lon,
- y,
- m,
- d,
- RISESET_CORRECTION_NAUTICAL,
- out rise_hour,
- out rise_min,
- out set_hour,
- out set_min);
-
- naut_rise = new DateTime.utc (y, m, d, rise_hour, rise_min, 0).to_timezone (time_zone);
- naut_set = new DateTime.utc (y, m, d, set_hour, set_min, 0).to_timezone (time_zone);
- if (naut_set.compare (naut_rise) < 0)
- naut_set = naut_set.add_days (1);
-
- calculate_sunrise_sunset (lat,
- lon,
- y,
- m,
- d,
- RISESET_CORRECTION_ASTRONOMICAL,
- out rise_hour,
- out rise_min,
- out set_hour,
- out set_min);
-
- astro_rise = new DateTime.utc (y, m, d, rise_hour, rise_min, 0).to_timezone (time_zone);
- astro_set = new DateTime.utc (y, m, d, set_hour, set_min, 0).to_timezone (time_zone);
- if (astro_set.compare (astro_rise) < 0)
- astro_set = astro_set.add_days (1);
+ utc.get_ymd (out year, out month, out day);
+
+ calculate_riseset_at_correction (latitude,
+ longitude,
+ year,
+ month,
+ day,
+ RISESET_CORRECTION_NONE,
+ out sun_rise,
+ out sun_set);
+ calculate_riseset_at_correction (latitude,
+ longitude,
+ year,
+ month,
+ day,
+ RISESET_CORRECTION_CIVIL,
+ out civil_rise,
+ out civil_set);
+ calculate_riseset_at_correction (latitude,
+ longitude,
+ year,
+ month,
+ day,
+ RISESET_CORRECTION_NAUTICAL,
+ out naut_rise,
+ out naut_set);
+ calculate_riseset_at_correction (latitude,
+ longitude,
+ year,
+ month,
+ day,
+ RISESET_CORRECTION_ASTRONOMICAL,
+ out astro_rise,
+ out astro_set);
+
+ last_calc_day = date_time.get_day_of_year ();
}
[Signal (run = "first")]
--
2.24.1

View File

@ -1 +1 @@
SHA512 (gnome-clocks-3.36.0.tar.xz) = 46013154aba26b7624ea76d02abb1210534bc6f0aec963c8882da7aa666b978a77b5bfd427c873aac58689f1321ffdb4b03c716b1a126ea34e5af7291c96ee5b
SHA512 (gnome-clocks-3.36.2.tar.xz) = 7b55a72e10c857e3dd0e6726b46647cb544bcee76f151af9b17a65e83b8a2e06564ed6875a0ac52dcdae6ac0f700b7b39aaf25194af52a5cb5449b2653316af6