From 978ec61f98f8620de43dbe701b9a7914c8f6eece Mon Sep 17 00:00:00 2001 From: Christopher Lam Date: Wed, 22 Nov 2017 18:43:13 +0800 Subject: [PATCH] Further scheme conversion to gdate to use time64 Add missing time64_to_gdate --- libgnucash/engine/gnc-date.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/libgnucash/engine/gnc-date.cpp b/libgnucash/engine/gnc-date.cpp index 86e56b79a3..060625f3cd 100644 --- a/libgnucash/engine/gnc-date.cpp +++ b/libgnucash/engine/gnc-date.cpp @@ -1346,6 +1346,20 @@ GDate timespec_to_gdate (Timespec ts) return result; } +GDate time64_to_gdate (time64 t) +{ + GDate result; + + g_date_clear (&result, 1); + GncDateTime time(t); + auto date = time.date().year_month_day(); + g_date_set_dmy (&result, date.day, static_cast(date.month), + date.year); + g_assert(g_date_valid (&result)); + + return result; +} + GDate* gnc_g_date_new_today () { GncDate gncd;