diff options
Diffstat (limited to 'libical/src')
-rw-r--r-- | libical/src/libical/icaltime.c | 17 | ||||
-rw-r--r-- | libical/src/libical/icaltime.h | 1 |
2 files changed, 18 insertions, 0 deletions
diff --git a/libical/src/libical/icaltime.c b/libical/src/libical/icaltime.c index 6f17278bde..6d651922d5 100644 --- a/libical/src/libical/icaltime.c +++ b/libical/src/libical/icaltime.c @@ -180,3 +180,20 @@ int icaltime_compare(struct icaltimetype a,struct icaltimetype b) } } + +int icaltime_compare_date_only(struct icaltimetype a, struct icaltimetype b) +{ + time_t t1 = icaltime_as_timet(a); + time_t t2 = icaltime_as_timet(b); + + if (a.year == b.year && a.month == b.month && a.day == b.day) { + return 0; + } + + if (t1 > t2) { + return 1; + } else if (t1 < t2) { + return -1; + } +} + diff --git a/libical/src/libical/icaltime.h b/libical/src/libical/icaltime.h index 64eaee0431..6c5b653c23 100644 --- a/libical/src/libical/icaltime.h +++ b/libical/src/libical/icaltime.h @@ -65,6 +65,7 @@ short icaltime_week_number(short day_of_month, short month, short year); struct icaltimetype icaltime_from_week_number(short week_number, short year); int icaltime_compare(struct icaltimetype a,struct icaltimetype b); +int icaltime_compare_date_only(struct icaltimetype a, struct icaltimetype b); short icaltime_days_in_month(short month,short year); |