diff --git a/gnucash/gnome/dialog-invoice.c b/gnucash/gnome/dialog-invoice.c index 83c921889f..43c08bf50b 100644 --- a/gnucash/gnome/dialog-invoice.c +++ b/gnucash/gnome/dialog-invoice.c @@ -308,7 +308,7 @@ static void gnc_ui_to_invoice (InvoiceWindow *iw, GncInvoice *invoice) GtkTextBuffer* text_buffer; GtkTextIter start, end; gchar *text; - Timespec ts; + time64 time; gboolean is_credit_note = gncInvoiceGetIsCreditNote (invoice); if (iw->dialog_type == VIEW_INVOICE) @@ -341,8 +341,8 @@ static void gnc_ui_to_invoice (InvoiceWindow *iw, GncInvoice *invoice) (GTK_EDITABLE (iw->billing_id_entry), 0, -1)); gncInvoiceSetTerms (invoice, iw->terms); - ts = gnc_date_edit_get_date_ts (GNC_DATE_EDIT (iw->opened_date)); - gncInvoiceSetDateOpened (invoice, ts); + time = gnc_date_edit_get_date (GNC_DATE_EDIT (iw->opened_date)); + gncInvoiceSetDateOpened (invoice, time); gnc_owner_get_owner (iw->owner_choice, &(iw->owner)); if (iw->job_choice) @@ -948,7 +948,7 @@ gnc_invoice_post(InvoiceWindow *iw, struct post_invoice_params *post_params) else auto_pay = gnc_prefs_get_bool (GNC_PREFS_GROUP_BILL, GNC_PREF_AUTO_PAY); - gncInvoicePostToAccount (invoice, acc, &postdate, &ddue, memo, accumulate, auto_pay); + gncInvoicePostToAccount (invoice, acc, postdate.tv_sec, ddue.tv_sec, memo, accumulate, auto_pay); cleanup: gncInvoiceCommitEdit (invoice); @@ -1747,8 +1747,8 @@ gnc_invoice_update_window (InvoiceWindow *iw, GtkWidget *widget) GtkTextBuffer* text_buffer; const char *string; gchar * tmp_string; - Timespec ts, ts_zero = {0, 0}; Account *acct; + time64 time; gtk_entry_set_text (GTK_ENTRY (iw->id_entry), gncInvoiceGetID (invoice)); @@ -1763,15 +1763,15 @@ gnc_invoice_update_window (InvoiceWindow *iw, GtkWidget *widget) gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (iw->active_check), gncInvoiceGetActive (invoice)); - ts = gncInvoiceGetDateOpened (invoice); - if (timespec_equal (&ts, &ts_zero)) + time = gncInvoiceGetDateOpened (invoice); + if (!time) { gnc_date_edit_set_time (GNC_DATE_EDIT (iw->opened_date), gnc_time (NULL)); } else { - gnc_date_edit_set_time_ts (GNC_DATE_EDIT (iw->opened_date), ts); + gnc_date_edit_set_time (GNC_DATE_EDIT (iw->opened_date), time); } /* fill in the terms text */ @@ -1816,8 +1816,8 @@ gnc_invoice_update_window (InvoiceWindow *iw, GtkWidget *widget) */ can_unpost = TRUE; - ts = gncInvoiceGetDatePosted (invoice); - gnc_date_edit_set_time_ts (GNC_DATE_EDIT (iw->posted_date), ts); + time = gncInvoiceGetDatePosted (invoice); + gnc_date_edit_set_time (GNC_DATE_EDIT (iw->posted_date), time); tmp_string = gnc_account_get_full_name (acct); gtk_entry_set_text (GTK_ENTRY (acct_entry), tmp_string); diff --git a/gnucash/gnome/dialog-payment.c b/gnucash/gnome/dialog-payment.c index e11d07ad97..305c5fc828 100644 --- a/gnucash/gnome/dialog-payment.c +++ b/gnucash/gnome/dialog-payment.c @@ -485,7 +485,6 @@ gnc_payment_window_fill_docs_list (PaymentWindow *pw) const gchar *doc_deb_str = NULL; const gchar *doc_cred_str = NULL; GtkTreeIter iter; - Timespec doc_date; GncInvoice *document; gnc_numeric value = gnc_numeric_zero(); gnc_numeric debit = gnc_numeric_zero(); @@ -497,17 +496,16 @@ gnc_payment_window_fill_docs_list (PaymentWindow *pw) /* Find the document's date or pre-payment date */ if (document) - doc_date = gncInvoiceGetDatePosted (document); + doc_date_time = gncInvoiceGetDatePosted (document); else { /* Calculate the payment date based on the lot splits */ Transaction *trans = xaccSplitGetParent (gnc_lot_get_latest_split (lot)); if (trans) - doc_date = xaccTransRetDatePostedTS (trans); + doc_date_time = xaccTransRetDatePosted (trans); else continue; /* No valid split in this lot, skip it */ } - doc_date_time = timespecToTime64 (doc_date); /* Find the document type. No type means pre-payment in this case */ if (document) diff --git a/gnucash/gnome/gnc-plugin-business.c b/gnucash/gnome/gnc-plugin-business.c index eb418b345c..121bd4852f 100644 --- a/gnucash/gnome/gnc-plugin-business.c +++ b/gnucash/gnome/gnc-plugin-business.c @@ -957,18 +957,17 @@ static void gnc_plugin_business_cmd_test_init_data (GtkAction *action, GncMainWindowActionData *data) { - QofBook *book = gnc_get_current_book(); + QofBook *book = gnc_get_current_book(); GncCustomer *customer = gncCustomerCreate(book); - GncAddress *address = gncCustomerGetAddr(customer); - GncInvoice *invoice = gncInvoiceCreate(book); - GncOwner *owner = gncOwnerNew(); - GncJob *job = gncJobCreate(book); - Account *root = gnc_book_get_root_account(book); - Account *inc_acct = xaccMallocAccount(book); - Account *bank_acct = xaccMallocAccount(book); - Account *tax_acct = xaccMallocAccount(book); - Account *ar_acct = xaccMallocAccount(book); - Timespec now; + GncAddress *address = gncCustomerGetAddr(customer); + GncInvoice *invoice = gncInvoiceCreate(book); + GncOwner *owner = gncOwnerNew(); + GncJob *job = gncJobCreate(book); + Account *root = gnc_book_get_root_account(book); + Account *inc_acct = xaccMallocAccount(book); + Account *bank_acct = xaccMallocAccount(book); + Account *tax_acct = xaccMallocAccount(book); + Account *ar_acct = xaccMallocAccount(book); // Create Customer gncCustomerSetID(customer, "000001"); @@ -983,10 +982,9 @@ gnc_plugin_business_cmd_test_init_data (GtkAction *action, gncOwnerInitCustomer(owner, customer); // Create the Invoice - timespecFromTime64(&now, time(NULL)); gncInvoiceSetID(invoice, "000012"); gncInvoiceSetOwner(invoice, owner); - gncInvoiceSetDateOpened(invoice, now); + gncInvoiceSetDateOpened(invoice, gnc_time (NULL)); gncInvoiceSetCurrency(invoice, gnc_default_currency()); // Create the Job diff --git a/gnucash/register/ledger-core/gncEntryLedger.c b/gnucash/register/ledger-core/gncEntryLedger.c index c8ac458dd1..b3ea14816c 100644 --- a/gnucash/register/ledger-core/gncEntryLedger.c +++ b/gnucash/register/ledger-core/gncEntryLedger.c @@ -566,7 +566,7 @@ void gnc_entry_ledger_set_default_invoice (GncEntryLedger *ledger, * to understand why. */ if (gncInvoiceGetOwnerType (invoice) == GNC_OWNER_VENDOR) - ledger->last_date_entered = timespec_to_gdate(gncInvoiceGetDateOpened (invoice)); + ledger->last_date_entered = time64_to_gdate(gncInvoiceGetDateOpened (invoice)); if (!ledger->query && invoice) create_invoice_query (ledger); diff --git a/libgnucash/backend/xml/gnc-invoice-xml-v2.cpp b/libgnucash/backend/xml/gnc-invoice-xml-v2.cpp index d2f2e01e49..1d3aef2855 100644 --- a/libgnucash/backend/xml/gnc-invoice-xml-v2.cpp +++ b/libgnucash/backend/xml/gnc-invoice-xml-v2.cpp @@ -81,17 +81,17 @@ maybe_add_string (xmlNodePtr ptr, const char* tag, const char* str) } static void -maybe_add_timespec (xmlNodePtr ptr, const char* tag, Timespec ts) +maybe_add_time64 (xmlNodePtr ptr, const char* tag, time64 time) { - if (ts.tv_sec) - xmlAddChild (ptr, time64_to_dom_tree (tag, ts.tv_sec)); + if (time) + xmlAddChild (ptr, time64_to_dom_tree (tag, time)); } static xmlNodePtr invoice_dom_tree_create (GncInvoice* invoice) { xmlNodePtr ret; - Timespec ts; + time64 time; Transaction* txn; GNCLot* lot; Account* acc; @@ -111,11 +111,10 @@ invoice_dom_tree_create (GncInvoice* invoice) xmlAddChild (ret, gnc_owner_to_dom_tree (invoice_owner_string, gncInvoiceGetOwner (invoice))); - ts = gncInvoiceGetDateOpened (invoice); - xmlAddChild (ret, time64_to_dom_tree (invoice_opened_string, ts.tv_sec)); + time = gncInvoiceGetDateOpened (invoice); + xmlAddChild (ret, time64_to_dom_tree (invoice_opened_string, time)); - maybe_add_timespec (ret, invoice_posted_string, - gncInvoiceGetDatePosted (invoice)); + maybe_add_time64 (ret, invoice_posted_string, gncInvoiceGetDatePosted (invoice)); term = gncInvoiceGetTerms (invoice); if (term) @@ -185,14 +184,12 @@ set_string (xmlNodePtr node, GncInvoice* invoice, } static inline gboolean -set_timespec (xmlNodePtr node, GncInvoice* invoice, - void (*func) (GncInvoice* invoice, Timespec ts)) +set_time64 (xmlNodePtr node, GncInvoice* invoice, + void (*func) (GncInvoice* invoice, time64 time)) { time64 time = dom_tree_to_time64 (node); if (!dom_tree_valid_time64 (time, node->name)) return FALSE; - - Timespec ts = {time, 0}; - func (invoice, ts); + func (invoice, time); return TRUE; } @@ -248,16 +245,14 @@ static gboolean invoice_opened_handler (xmlNodePtr node, gpointer invoice_pdata) { struct invoice_pdata* pdata = static_cast (invoice_pdata); - - return set_timespec (node, pdata->invoice, gncInvoiceSetDateOpened); + return set_time64 (node, pdata->invoice, gncInvoiceSetDateOpened); } static gboolean invoice_posted_handler (xmlNodePtr node, gpointer invoice_pdata) { struct invoice_pdata* pdata = static_cast (invoice_pdata); - - return set_timespec (node, pdata->invoice, gncInvoiceSetDatePosted); + return set_time64 (node, pdata->invoice, gncInvoiceSetDatePosted); } static gboolean diff --git a/libgnucash/engine/Transaction.c b/libgnucash/engine/Transaction.c index dfc910729c..a541d40033 100644 --- a/libgnucash/engine/Transaction.c +++ b/libgnucash/engine/Transaction.c @@ -2055,6 +2055,13 @@ xaccTransSetDate (Transaction *trans, int day, int mon, int year) g_free(date); } +void +xaccTransSetDateDue (Transaction * trans, time64 time) +{ + Timespec ts_send = {time, 0}; + xaccTransSetDateDueTS (trans, &ts_send); +} + void xaccTransSetDateDueTS (Transaction *trans, const Timespec *ts) { diff --git a/libgnucash/engine/Transaction.h b/libgnucash/engine/Transaction.h index 610463307f..2ad312328b 100644 --- a/libgnucash/engine/Transaction.h +++ b/libgnucash/engine/Transaction.h @@ -640,6 +640,7 @@ void xaccTransSetDateEnteredTS (Transaction *trans, /** Dates and txn-type for A/R and A/P "invoice" postings */ void xaccTransSetDateDueTS (Transaction *trans, const Timespec *ts); +void xaccTransSetDateDue (Transaction * trans, time64 time); /** Retrieve the posted date of the transaction. The posted date is the date when this transaction was posted at the bank. (Although diff --git a/libgnucash/engine/gncInvoice.c b/libgnucash/engine/gncInvoice.c index 670c34434c..139f932ff8 100644 --- a/libgnucash/engine/gncInvoice.c +++ b/libgnucash/engine/gncInvoice.c @@ -61,8 +61,8 @@ struct _gncInvoice GncOwner owner; GncOwner billto; GncJob *job; - Timespec date_opened; - Timespec date_posted; + time64 date_opened; + time64 date_posted; gnc_numeric to_charge_amount; @@ -481,23 +481,23 @@ qofInvoiceSetBillTo (GncInvoice *invoice, QofInstance *ent) void gncInvoiceSetDateOpenedGDate (GncInvoice *invoice, const GDate *date) { g_assert (date); - gncInvoiceSetDateOpened(invoice, timespecCanonicalDayTime(gdate_to_timespec(*date))); + gncInvoiceSetDateOpened(invoice, time64CanonicalDayTime(gdate_to_time64 (*date))); } -void gncInvoiceSetDateOpened (GncInvoice *invoice, Timespec date) +void gncInvoiceSetDateOpened (GncInvoice *invoice, time64 date) { if (!invoice) return; - if (timespec_equal (&invoice->date_opened, &date)) return; + if (date == invoice->date_opened) return; gncInvoiceBeginEdit (invoice); invoice->date_opened = date; mark_invoice (invoice); gncInvoiceCommitEdit (invoice); } -void gncInvoiceSetDatePosted (GncInvoice *invoice, Timespec date) +void gncInvoiceSetDatePosted (GncInvoice *invoice, time64 date) { if (!invoice) return; - if (timespec_equal (&invoice->date_posted, &date)) return; + if (date == invoice->date_posted) return; gncInvoiceBeginEdit (invoice); invoice->date_posted = date; mark_invoice (invoice); @@ -805,52 +805,25 @@ qofInvoiceGetBillTo (GncInvoice *invoice) return QOF_INSTANCE(billto); } -Timespec gncInvoiceGetDateOpened (const GncInvoice *invoice) +time64 gncInvoiceGetDateOpened (const GncInvoice *invoice) { - Timespec ts; - ts.tv_sec = 0; - ts.tv_nsec = 0; - if (!invoice) return ts; + if (!invoice) return 0; return invoice->date_opened; } -Timespec gncInvoiceGetDatePosted (const GncInvoice *invoice) +time64 gncInvoiceGetDatePosted (const GncInvoice *invoice) { - Timespec ts; - ts.tv_sec = 0; - ts.tv_nsec = 0; - if (!invoice) return ts; + if (!invoice) return 0; return invoice->date_posted; } -Timespec gncInvoiceGetDateDue (const GncInvoice *invoice) +time64 gncInvoiceGetDateDue (const GncInvoice *invoice) { Transaction *txn; - Timespec ts; - ts.tv_sec = 0; - ts.tv_nsec = 0; - if (!invoice) return ts; + if (!invoice) return 0; txn = gncInvoiceGetPostedTxn (invoice); - if (!txn) return ts; - return xaccTransRetDateDueTS (txn); -} - -time64 gncInvoiceGetDateOpenedTT (const GncInvoice *invoice) -{ - if (!invoice) return 0; - return invoice->date_opened.tv_sec; -} - -time64 gncInvoiceGetDatePostedTT (const GncInvoice *invoice) -{ - if (!invoice) return 0; - return invoice->date_posted.tv_sec; -} - -time64 gncInvoiceGetDateDueTT (const GncInvoice *invoice) -{ - if (!invoice) return 0; - return gncInvoiceGetDateDue (invoice).tv_sec; + if (!txn) return 0; + return xaccTransRetDateDue (txn); } GncBillTerm * gncInvoiceGetTerms (const GncInvoice *invoice) @@ -1384,7 +1357,7 @@ static gboolean gncInvoicePostAddSplit (QofBook *book, } Transaction * gncInvoicePostToAccount (GncInvoice *invoice, Account *acc, - Timespec *post_date, Timespec *due_date, + time64 post_date, time64 due_date, const char * memo, gboolean accumulatesplits, gboolean autopay) { @@ -1446,14 +1419,10 @@ Transaction * gncInvoicePostToAccount (GncInvoice *invoice, Account *acc, /* Entered and Posted at date */ xaccTransSetDateEnteredSecs (txn, gnc_time (NULL)); - if (post_date) - { - xaccTransSetDatePostedTS (txn, post_date); - gncInvoiceSetDatePosted (invoice, *post_date); - } + xaccTransSetDatePostedSecs (txn, post_date); + gncInvoiceSetDatePosted (invoice, post_date); - if (due_date) - xaccTransSetDateDueTS (txn, due_date); + xaccTransSetDateDue (txn, due_date); /* Iterate through the entries; sum up everything for each account. * then create the appropriate splits in this txn. @@ -1749,7 +1718,7 @@ gncInvoiceUnpost (GncInvoice *invoice, gboolean reset_tax_tables) invoice->posted_acc = NULL; invoice->posted_txn = NULL; invoice->posted_lot = NULL; - invoice->date_posted.tv_sec = invoice->date_posted.tv_nsec = 0; + invoice->date_posted = 0; /* if we've been asked to reset the tax tables, then do so */ if (reset_tax_tables) @@ -1857,12 +1826,13 @@ void gncInvoiceAutoApplyPayments (GncInvoice *invoice) void gncInvoiceApplyPayment (const GncInvoice *invoice, Transaction *txn, Account *xfer_acc, gnc_numeric amount, - gnc_numeric exch, Timespec date, + gnc_numeric exch, time64 date, const char *memo, const char *num) { GNCLot *payment_lot; GList *selected_lots = NULL; const GncOwner *owner; + Timespec ts_pass = {date,0}; /* Verify our arguments */ if (!invoice || !gncInvoiceIsPosted (invoice) || !xfer_acc) return; @@ -1872,7 +1842,7 @@ gncInvoiceApplyPayment (const GncInvoice *invoice, Transaction *txn, /* Create a lot for this payment */ payment_lot = gncOwnerCreatePaymentLot (owner, &txn, invoice->posted_acc, xfer_acc, - amount, exch, date, memo, num); + amount, exch, ts_pass, memo, num); /* Select the invoice as only payment candidate */ selected_lots = g_list_prepend (selected_lots, invoice->posted_lot); @@ -1883,17 +1853,15 @@ gncInvoiceApplyPayment (const GncInvoice *invoice, Transaction *txn, gncOwnerAutoApplyPaymentsWithLots (owner, selected_lots); } -static gboolean gncInvoiceDateExists (const Timespec *date) +static gboolean gncInvoiceDateExists (time64 date) { - g_return_val_if_fail (date, FALSE); - if (date->tv_sec || date->tv_nsec) return TRUE; - return FALSE; + return date; } gboolean gncInvoiceIsPosted (const GncInvoice *invoice) { if (!invoice) return FALSE; - return gncInvoiceDateExists (&(invoice->date_posted)); + return gncInvoiceDateExists (invoice->date_posted); } gboolean gncInvoiceIsPaid (const GncInvoice *invoice) @@ -1941,13 +1909,8 @@ int gncInvoiceCompare (const GncInvoice *a, const GncInvoice *b) compare = g_strcmp0 (a->id, b->id); if (compare) return compare; - - compare = timespec_cmp (&(a->date_opened), &(b->date_opened)); - if (compare) return compare; - - compare = timespec_cmp (&(a->date_posted), &(b->date_posted)); - if (compare) return compare; - + if (a->date_opened != b->date_opened) return a->date_opened - b->date_opened; + if (a->date_posted != b->date_posted) return a->date_posted - b->date_posted; return qof_instance_guid_compare(a, b); } @@ -2033,8 +1996,8 @@ gboolean gncInvoiceEqual(const GncInvoice *a, const GncInvoice *b) GList *prices; GncOwner owner; GncOwner billto; - Timespec date_opened; - Timespec date_posted; + time64 date_opened; + time64 date_posted; gnc_numeric to_charge_amount; #endif diff --git a/libgnucash/engine/gncInvoice.h b/libgnucash/engine/gncInvoice.h index 65858983a2..1b5b65a736 100644 --- a/libgnucash/engine/gncInvoice.h +++ b/libgnucash/engine/gncInvoice.h @@ -101,10 +101,10 @@ GncInvoice *gncInvoiceCopy (const GncInvoice *other_invoice); void gncInvoiceSetID (GncInvoice *invoice, const char *id); void gncInvoiceSetOwner (GncInvoice *invoice, GncOwner *owner); /** Set the DateOpened using a GDate argument. (Note: Internally this stores -the date in a Timespec as created through timespecCanonicalDayTime()). */ +the date in a time64 as created through timespecCanonicalDayTime()). */ void gncInvoiceSetDateOpenedGDate (GncInvoice *invoice, const GDate *date); -void gncInvoiceSetDateOpened (GncInvoice *invoice, Timespec date); -void gncInvoiceSetDatePosted (GncInvoice *invoice, Timespec date); +void gncInvoiceSetDateOpened (GncInvoice *invoice, time64 date); +void gncInvoiceSetDatePosted (GncInvoice *invoice, time64 date); void gncInvoiceSetTerms (GncInvoice *invoice, GncBillTerm *terms); void gncInvoiceSetBillingID (GncInvoice *invoice, const char *billing_id); void gncInvoiceSetNotes (GncInvoice *invoice, const char *notes); @@ -137,12 +137,9 @@ void gncInvoiceRemoveEntries (GncInvoice *invoice); @{ */ const char * gncInvoiceGetID (const GncInvoice *invoice); const GncOwner * gncInvoiceGetOwner (const GncInvoice *invoice); -Timespec gncInvoiceGetDateOpened (const GncInvoice *invoice); -time64 gncInvoiceGetDateOpenedTT (const GncInvoice *invoice); -Timespec gncInvoiceGetDatePosted (const GncInvoice *invoice); -time64 gncInvoiceGetDatePostedTT (const GncInvoice *invoice); -Timespec gncInvoiceGetDateDue (const GncInvoice *invoice); -time64 gncInvoiceGetDateDueTT (const GncInvoice *invoice); +time64 gncInvoiceGetDateOpened (const GncInvoice *invoice); +time64 gncInvoiceGetDatePosted (const GncInvoice *invoice); +time64 gncInvoiceGetDateDue (const GncInvoice *invoice); GncBillTerm * gncInvoiceGetTerms (const GncInvoice *invoice); const char * gncInvoiceGetBillingID (const GncInvoice *invoice); const char * gncInvoiceGetNotes (const GncInvoice *invoice); @@ -212,7 +209,7 @@ GHashTable *gncInvoiceGetForeignCurrencies (const GncInvoice *invoice); */ Transaction * gncInvoicePostToAccount (GncInvoice *invoice, Account *acc, - Timespec *posted_date, Timespec *due_date, + time64 posted_date, time64 due_date, const char *memo, gboolean accumulatesplits, gboolean autopay); @@ -253,7 +250,7 @@ gncInvoiceAutoApplyPayments (GncInvoice *invoice); void gncInvoiceApplyPayment (const GncInvoice *invoice, Transaction *txn, Account *xfer_acc, gnc_numeric amount, - gnc_numeric exch, Timespec date, + gnc_numeric exch, time64 date, const char *memo, const char *num); diff --git a/libgnucash/engine/gncOwner.c b/libgnucash/engine/gncOwner.c index c6616c594e..2aad3c2f7f 100644 --- a/libgnucash/engine/gncOwner.c +++ b/libgnucash/engine/gncOwner.c @@ -704,7 +704,7 @@ gint gncOwnerLotsSortFunc (GNCLot *lotA, GNCLot *lotB) { GncInvoice *ia, *ib; - Timespec da, db; + time64 da, db; ia = gncInvoiceGetInvoiceFromLot (lotA); ib = gncInvoiceGetInvoiceFromLot (lotB); @@ -712,14 +712,14 @@ gncOwnerLotsSortFunc (GNCLot *lotA, GNCLot *lotB) if (ia) da = gncInvoiceGetDateDue (ia); else - da = xaccTransRetDatePostedTS (xaccSplitGetParent (gnc_lot_get_earliest_split (lotA))); + da = xaccTransRetDatePostedTS (xaccSplitGetParent (gnc_lot_get_earliest_split (lotA))).tv_sec; if (ib) db = gncInvoiceGetDateDue (ib); else - db = xaccTransRetDatePostedTS (xaccSplitGetParent (gnc_lot_get_earliest_split (lotB))); + db = xaccTransRetDatePostedTS (xaccSplitGetParent (gnc_lot_get_earliest_split (lotB))).tv_sec; - return timespec_cmp (&da, &db); + return (da > db) - (da < db); } GNCLot * diff --git a/libgnucash/engine/test/utest-Invoice.c b/libgnucash/engine/test/utest-Invoice.c index a55104d0d3..fe8eb7b769 100644 --- a/libgnucash/engine/test/utest-Invoice.c +++ b/libgnucash/engine/test/utest-Invoice.c @@ -69,7 +69,8 @@ static void test_invoice_post ( Fixture *fixture, gconstpointer pData ) { GncInvoice *invoice = gncInvoiceCreate(fixture->book); - Timespec ts1 = timespec_now(), ts2 = ts1; + time64 ts1 = gnc_time(NULL); + time64 ts2 = ts1; g_assert(invoice); g_assert(!gncInvoiceGetIsCreditNote(invoice)); g_assert(gncInvoiceGetActive(invoice)); @@ -81,7 +82,7 @@ test_invoice_post ( Fixture *fixture, gconstpointer pData ) g_test_message( "Will now post the invoice" ); g_assert(!gncInvoiceIsPosted(invoice)); - gncInvoicePostToAccount(invoice, fixture->account, &ts1, &ts2, "memo", TRUE, FALSE); + gncInvoicePostToAccount(invoice, fixture->account, ts1, ts2, "memo", TRUE, FALSE); g_assert(gncInvoiceIsPosted(invoice)); gncInvoiceUnpost(invoice, TRUE);