diff --git a/src/core/gcal-range.c b/src/core/gcal-range.c index f9b4cde8..8360466a 100644 --- a/src/core/gcal-range.c +++ b/src/core/gcal-range.c @@ -507,12 +507,17 @@ gcal_range_compare (GcalRange *a, &start_timestamp_a, &end_timestamp_a, &start_timestamp_b, &end_timestamp_b); - result = start_timestamp_b - start_timestamp_a; + result = start_timestamp_a - start_timestamp_b; if (result == 0) - result = end_timestamp_b - end_timestamp_a; + result = end_timestamp_a - end_timestamp_b; - return result; + if (result < 0) + return GCAL_RANGE_BEFORE; + else if (result > 0) + return GCAL_RANGE_AFTER; + else + return GCAL_RANGE_MATCH; } /** diff --git a/src/core/gcal-range.h b/src/core/gcal-range.h index e967ba34..3c1b8373 100644 --- a/src/core/gcal-range.h +++ b/src/core/gcal-range.h @@ -51,10 +51,10 @@ typedef enum * GcalRangePosition: * * @GCAL_RANGE_BEFORE: range @a is before @b + * @GCAL_RANGE_MATCH: range @a is equal to @b * @GCAL_RANGE_AFTER: range @a is after @b * - * The position of @a relative to @b. When the ranges are exactly equal, it - * is undefined. + * The position of @a relative to @b. */ typedef enum {