From 822ca45220db0b864af9dc79b94bda03a9323621 Mon Sep 17 00:00:00 2001 From: Derick Rethans Date: Fri, 29 Jan 2016 15:21:55 +0100 Subject: Merge in changes in timelib 2016.01 --- ext/date/lib/timelib.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'ext/date/lib/timelib.c') diff --git a/ext/date/lib/timelib.c b/ext/date/lib/timelib.c index 73cdfa2d85..b938d9f998 100644 --- a/ext/date/lib/timelib.c +++ b/ext/date/lib/timelib.c @@ -65,6 +65,23 @@ timelib_time* timelib_time_clone(timelib_time *orig) return tmp; } +int timelib_time_compare(timelib_time *t1, timelib_time *t2) +{ + if (t1->sse == t2->sse) { + if (t1->f == t2->f) { + return 0; + } + + if (t1->sse < 0) { + return (t1->f < t2->f) ? 1 : -1; + } else { + return (t1->f < t2->f) ? -1 : 1; + } + } + + return (t1->sse < t2->sse) ? -1 : 1; +} + timelib_rel_time* timelib_rel_time_clone(timelib_rel_time *rel) { timelib_rel_time *tmp = timelib_rel_time_ctor(); -- cgit v1.2.1