From 375277fa6b2c8eaac2e2a824bd1e43bbd54b75e3 Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Sun, 9 Mar 2014 17:46:08 -0500 Subject: in utils.c's generate_full_format_string_at_time(), test to see if the event time occurred before the current time --- src/utils.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/utils.c') diff --git a/src/utils.c b/src/utils.c index f4eb53f..354e389 100644 --- a/src/utils.c +++ b/src/utils.c @@ -159,6 +159,10 @@ getDateProximity(GDateTime* now, GDateTime* time) gint now_year, now_month, now_day; gint time_year, time_month, time_day; + // did it already happen? + if (g_date_time_compare (now, time) > 0) + return DATE_PROXIMITY_FAR; + // does it happen today? g_date_time_get_ymd(now, &now_year, &now_month, &now_day); g_date_time_get_ymd(time, &time_year, &time_month, &time_day); -- cgit v1.2.3 From 35b0a3601f1d7d9f757467ffc7b909c461c2f49d Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Fri, 14 Mar 2014 11:48:06 -0500 Subject: slightly better testing for whether or not a date happened in the past at second granularity rather than usec --- src/utils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/utils.c') diff --git a/src/utils.c b/src/utils.c index 354e389..c9107ce 100644 --- a/src/utils.c +++ b/src/utils.c @@ -160,7 +160,7 @@ getDateProximity(GDateTime* now, GDateTime* time) gint time_year, time_month, time_day; // did it already happen? - if (g_date_time_compare (now, time) > 0) + if (g_date_time_difference(time, now) < -G_USEC_PER_SEC) return DATE_PROXIMITY_FAR; // does it happen today? -- cgit v1.2.3