gnucash stable: Multiple changes pushed
Christopher Lam
clam at code.gnucash.org
Sun Sep 8 09:12:00 EDT 2024
Updated via https://github.com/Gnucash/gnucash/commit/d935edee (commit)
via https://github.com/Gnucash/gnucash/commit/9c4ef934 (commit)
from https://github.com/Gnucash/gnucash/commit/04c3191b (commit)
commit d935edeea5d02b63daf566f749a5f289dee7a91f
Author: Christopher Lam <christopher.lck at gmail.com>
Date: Sun Sep 8 21:10:49 2024 +0800
[gnc-date.cpp] deprecate gnc_difftime
because it casts time64 to doubles
diff --git a/libgnucash/engine/gnc-date.cpp b/libgnucash/engine/gnc-date.cpp
index 8c8cf49baa..f64863888d 100644
--- a/libgnucash/engine/gnc-date.cpp
+++ b/libgnucash/engine/gnc-date.cpp
@@ -270,6 +270,7 @@ gnc_time (time64 *tbuf)
gdouble
gnc_difftime (const time64 secs1, const time64 secs2)
{
+ PWARN ("gnc_difftime is deprecated");
return (double)secs1 - (double)secs2;
}
diff --git a/libgnucash/engine/gnc-date.h b/libgnucash/engine/gnc-date.h
index 2b0c251862..d44bc2b289 100644
--- a/libgnucash/engine/gnc-date.h
+++ b/libgnucash/engine/gnc-date.h
@@ -224,6 +224,7 @@ gchar* gnc_ctime (const time64 *secs);
time64 gnc_time (time64 *tbuf);
/** \brief Find the difference in seconds between two time values
+ * (deprecated)
* \param secs1: The first time value, in Seconds since
* 00:00:00 UTC 01 January 1970 (negative values are seconds before that moment)
* \param secs2: The second time value, in Seconds since
commit 9c4ef934ce0d9925c197be87e14f8262816dc938
Author: Christopher Lam <christopher.lck at gmail.com>
Date: Sun Sep 8 21:10:41 2024 +0800
don't use gnc_difftime
because it casts time64 to doubles
diff --git a/gnucash/gnome/reconcile-view.c b/gnucash/gnome/reconcile-view.c
index 27924be5ad..c52473f8c9 100644
--- a/gnucash/gnome/reconcile-view.c
+++ b/gnucash/gnome/reconcile-view.c
@@ -397,7 +397,7 @@ gnc_reconcile_view_new (Account *account, GNCReconcileViewType type,
/* Just an extra verification that our query is correct ;) */
g_assert (recn == NREC || recn == CREC);
- if (recn == CREC && gnc_difftime (trans_date, statement_date_day_end) <= 0)
+ if (recn == CREC && trans_date <= statement_date_day_end)
g_hash_table_insert (view->reconciled, split, split);
}
}
@@ -973,9 +973,8 @@ gnc_reconcile_view_postpone (GNCReconcileView *view)
// Don't change splits past reconciliation date that haven't been
// set to be reconciled
- if (gnc_difftime (view->statement_date,
- xaccTransGetDate (xaccSplitGetParent (entry))) >= 0 ||
- g_hash_table_lookup (view->reconciled, entry))
+ if (view->statement_date >= xaccTransGetDate (xaccSplitGetParent (entry)) ||
+ g_hash_table_lookup (view->reconciled, entry))
{
recn = g_hash_table_lookup (view->reconciled, entry) ? CREC : NREC;
xaccSplitSetReconcile (entry, recn);
diff --git a/gnucash/gnome/window-reconcile.cpp b/gnucash/gnome/window-reconcile.cpp
index 66f6d651fd..336123a84e 100644
--- a/gnucash/gnome/window-reconcile.cpp
+++ b/gnucash/gnome/window-reconcile.cpp
@@ -603,7 +603,6 @@ gnc_save_reconcile_interval(Account *account, time64 statement_date)
{
time64 prev_statement_date;
int days = 0, months = 0;
- double seconds;
if (!xaccAccountGetReconcileLastDate (account, &prev_statement_date))
return;
@@ -611,8 +610,8 @@ gnc_save_reconcile_interval(Account *account, time64 statement_date)
/*
* Compute the number of days difference.
*/
- seconds = gnc_difftime (statement_date, prev_statement_date);
- days = (int)(seconds / 60 / 60 / 24);
+ auto seconds = statement_date - prev_statement_date;
+ days = seconds / 60 / 60 / 24;
/*
* See if we need to remember days(weeks) or months. The only trick
Summary of changes:
gnucash/gnome/reconcile-view.c | 7 +++----
gnucash/gnome/window-reconcile.cpp | 5 ++---
libgnucash/engine/gnc-date.cpp | 1 +
libgnucash/engine/gnc-date.h | 1 +
4 files changed, 7 insertions(+), 7 deletions(-)
More information about the gnucash-changes
mailing list