[gnome-todo] scheduled: Round up when comparing UTC dates
- From: Gitlab Administrative User <gitlab src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-todo] scheduled: Round up when comparing UTC dates
- Date: Sat, 11 Nov 2017 06:00:51 +0000 (UTC)
commit 0d63fb1ee3ec07c7a9a3f15d2a94f852225a71a8
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Sat Nov 11 03:53:47 2017 -0200
scheduled: Round up when comparing UTC dates
Related to #113
plugins/scheduled-panel/gtd-panel-scheduled.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
---
diff --git a/plugins/scheduled-panel/gtd-panel-scheduled.c b/plugins/scheduled-panel/gtd-panel-scheduled.c
index c7d13fc..8b41b7f 100644
--- a/plugins/scheduled-panel/gtd-panel-scheduled.c
+++ b/plugins/scheduled-panel/gtd-panel-scheduled.c
@@ -57,15 +57,21 @@ get_date_offset (GDateTime *dt,
gint *days_diff,
gint *years_diff)
{
- g_autoptr (GDateTime) now;
+ g_autoptr (GDateTime) now, utc;
now = g_date_time_new_now_local ();
+ utc = g_date_time_new_utc (g_date_time_get_year (now),
+ g_date_time_get_month (now),
+ g_date_time_get_day_of_month (now),
+ g_date_time_get_hour (now),
+ g_date_time_get_minute (now),
+ g_date_time_get_seconds (now));
if (days_diff)
- *days_diff = g_date_time_difference (dt, now) / G_TIME_SPAN_DAY;
+ *days_diff = ceil ((gdouble) g_date_time_difference (dt, utc) / (gdouble) G_TIME_SPAN_DAY);
if (years_diff)
- *years_diff = g_date_time_get_year (dt) - g_date_time_get_year (now);
+ *years_diff = g_date_time_get_year (dt) - g_date_time_get_year (utc);
}
static gchar*
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]