aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCharles Kerr <charles.kerr@canonical.com>2015-04-05 18:26:37 -0500
committerCharles Kerr <charles.kerr@canonical.com>2015-04-05 18:26:37 -0500
commit32de6c5e866527c03e015f2c691837ea7800290e (patch)
tree77f66fe9a2f1561c0b162fa8d4d809e13c8c5250
parent62d68e6453c0ad69ff4d71099441a8151e9a9bea (diff)
downloadayatana-indicator-datetime-32de6c5e866527c03e015f2c691837ea7800290e.tar.gz
ayatana-indicator-datetime-32de6c5e866527c03e015f2c691837ea7800290e.tar.bz2
ayatana-indicator-datetime-32de6c5e866527c03e015f2c691837ea7800290e.zip
make DateTime::is_same_day() faster
-rw-r--r--src/date-time.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/date-time.cpp b/src/date-time.cpp
index ecfc971..54601d0 100644
--- a/src/date-time.cpp
+++ b/src/date-time.cpp
@@ -254,10 +254,12 @@ bool DateTime::is_same_day(const DateTime& a, const DateTime& b)
if (!a.m_dt || !b.m_dt)
return false;
- const auto adt = a.get();
- const auto bdt = b.get();
- return (g_date_time_get_year(adt) == g_date_time_get_year(bdt))
- && (g_date_time_get_day_of_year(adt) == g_date_time_get_day_of_year(bdt));
+ int ay, am, ad;
+ int by, bm, bd;
+ g_date_time_get_ymd(a.get(), &ay, &am, &ad);
+ g_date_time_get_ymd(b.get(), &by, &bm, &bd);
+
+ return (ay==by) && (am==bm) && (ad==bd);
}
bool DateTime::is_same_minute(const DateTime& a, const DateTime& b)