diff options
author | JP Rosevear <jpr@helixcode.com> | 2000-09-08 23:37:37 +0800 |
---|---|---|
committer | JP Rosevear <jpr@src.gnome.org> | 2000-09-08 23:37:37 +0800 |
commit | 701cbac178b95c516269e8f908c69387745499ba (patch) | |
tree | 57aa665dd57fb7537b84b9404a9d8c7aaa992775 /libical/src | |
parent | 7a7653f20a4e115339a40ceba828a6ccd35e4653 (diff) | |
download | gsoc2013-evolution-701cbac178b95c516269e8f908c69387745499ba.tar.gz gsoc2013-evolution-701cbac178b95c516269e8f908c69387745499ba.tar.zst gsoc2013-evolution-701cbac178b95c516269e8f908c69387745499ba.zip |
New function that compares only the dates, not the times as well
2000-09-08 JP Rosevear <jpr@helixcode.com>
* src/libical/icaltime.c (icaltime_compare_date_only): New
function that compares only the dates, not the times as well
* src/libical/icaltime.h: Add prototype
svn path=/trunk/; revision=5260
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); |