aboutsummaryrefslogtreecommitdiffstats
path: root/libical
diff options
context:
space:
mode:
Diffstat (limited to 'libical')
-rw-r--r--libical/ChangeLog7
-rw-r--r--libical/src/libical/icaltime.c17
-rw-r--r--libical/src/libical/icaltime.h1
3 files changed, 25 insertions, 0 deletions
diff --git a/libical/ChangeLog b/libical/ChangeLog
index 1fec1bcc29..b256f7641a 100644
--- a/libical/ChangeLog
+++ b/libical/ChangeLog
@@ -1,3 +1,10 @@
+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
+
2000-09-01 JP Rosevear <jpr@helixcode.com>
* configure.in: We don't need AC_PROG_RANLIB and
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);