diff --git a/src/engine/Transaction.c b/src/engine/Transaction.c index 9878eacaa4..53f01b2d4a 100644 --- a/src/engine/Transaction.c +++ b/src/engine/Transaction.c @@ -1803,6 +1803,14 @@ xaccTransSetDatePostedSecs (Transaction *trans, time64 secs) set_gains_date_dirty (trans); } +void +xaccTransSetDatePostedSecsNormalized (Transaction *trans, time64 time) +{ + GDate date; + gnc_gdate_set_time64(&date, time); + xaccTransSetDatePostedGDate(trans, date); +} + void xaccTransSetDatePostedGDate (Transaction *trans, GDate date) { diff --git a/src/engine/Transaction.h b/src/engine/Transaction.h index 70c16d6dcb..51ba5e0052 100644 --- a/src/engine/Transaction.h +++ b/src/engine/Transaction.h @@ -556,11 +556,27 @@ void xaccTransSetDate (Transaction *trans, void xaccTransSetDatePostedGDate (Transaction *trans, GDate date); /** The xaccTransSetDatePostedSecs() method will modify the posted - date of the transaction, specified by a time64 (see ctime(3)). The - posted date is the date when this transaction was posted at the - bank. */ + * date of the transaction, specified by a time64 (see ctime(3)). The + * posted date is the date when this transaction was posted at the + * bank. + * + * Please do not use this function, as the extra time-of-day part messes up a + * lot of places. Rather, please use xaccTransSetDatePostedGDate() or + * xaccTransSetDatePostedSecsNormalized(). + */ void xaccTransSetDatePostedSecs (Transaction *trans, time64 time); +/** This function sets the posted date of the transaction, specified by + * a time64 (see ctime(3)). Contrary to xaccTransSetDatePostedSecs(), the time + * will be normalized to only the date part, and the time-of-day will be + * ignored. The resulting date is the same as if it had been set as a GDate + * through xaccTransSetDatePostedGDate(). + * + * Please prefer this function over xaccTransSetDatePostedSecs(). + * + * The posted date is the date when this transaction was posted at the bank. */ +void xaccTransSetDatePostedSecsNormalized (Transaction *trans, time64 time); + /** The xaccTransSetDatePostedTS() method does the same thing as xaccTransSetDatePostedSecs(), but takes a struct timespec64. */ void xaccTransSetDatePostedTS (Transaction *trans,