aboutsummaryrefslogtreecommitdiffstats
path: root/libical/src
diff options
context:
space:
mode:
authorJP Rosevear <jpr@helixcode.com>2000-09-08 23:37:37 +0800
committerJP Rosevear <jpr@src.gnome.org>2000-09-08 23:37:37 +0800
commit701cbac178b95c516269e8f908c69387745499ba (patch)
tree57aa665dd57fb7537b84b9404a9d8c7aaa992775 /libical/src
parent7a7653f20a4e115339a40ceba828a6ccd35e4653 (diff)
downloadgsoc2013-evolution-701cbac178b95c516269e8f908c69387745499ba.tar
gsoc2013-evolution-701cbac178b95c516269e8f908c69387745499ba.tar.gz
gsoc2013-evolution-701cbac178b95c516269e8f908c69387745499ba.tar.bz2
gsoc2013-evolution-701cbac178b95c516269e8f908c69387745499ba.tar.lz
gsoc2013-evolution-701cbac178b95c516269e8f908c69387745499ba.tar.xz
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.c17
-rw-r--r--libical/src/libical/icaltime.h1
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);