Convert all time_t to time64: engine

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@22621 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
John Ralls 2012-12-01 22:44:53 +00:00
parent 6716e3ac5b
commit 7694f858d1
20 changed files with 95 additions and 92 deletions

View File

@ -3038,14 +3038,14 @@ xaccAccountGetProjectedMinimumBalance (const Account *acc)
{
AccountPrivate *priv;
GList *node;
time_t today;
time64 today;
gnc_numeric lowest = gnc_numeric_zero ();
int seen_a_transaction = 0;
g_return_val_if_fail(GNC_IS_ACCOUNT(acc), gnc_numeric_zero());
priv = GET_PRIVATE(acc);
today = gnc_timet_get_today_end();
today = gnc_time64_get_today_end();
for (node = g_list_last(priv->splits); node; node = node->prev)
{
Split *split = node->data;
@ -3072,7 +3072,7 @@ xaccAccountGetProjectedMinimumBalance (const Account *acc)
\********************************************************************/
gnc_numeric
xaccAccountGetBalanceAsOfDate (Account *acc, time_t date)
xaccAccountGetBalanceAsOfDate (Account *acc, time64 date)
{
/* Ideally this could use xaccAccountForEachSplit, but
* it doesn't exist yet and I'm uncertain of exactly how
@ -3096,11 +3096,11 @@ xaccAccountGetBalanceAsOfDate (Account *acc, time_t date)
/* Since transaction post times are stored as a Timespec,
* convert date into a Timespec as well rather than converting
* each transaction's Timespec into a time_t.
* each transaction's Timespec into a time64.
*
* FIXME: CAS: I think this comment is a bogus justification for
* using xaccTransGetDatePostedTS. There's no benefit to using
* Timespec when the input argument is time_t, and it's hard to
* Timespec when the input argument is time64, and it's hard to
* imagine that casting long long to long and comparing two longs is
* worse than comparing two long longs every time. IMO,
* xaccAccountGetPresentBalance gets this right, and its algorithm
@ -3156,12 +3156,12 @@ xaccAccountGetPresentBalance (const Account *acc)
{
AccountPrivate *priv;
GList *node;
time_t today;
time64 today;
g_return_val_if_fail(GNC_IS_ACCOUNT(acc), gnc_numeric_zero());
priv = GET_PRIVATE(acc);
today = gnc_timet_get_today_end();
today = gnc_time64_get_today_end();
for (node = g_list_last(priv->splits); node; node = node->prev)
{
Split *split = node->data;
@ -3214,7 +3214,7 @@ xaccAccountConvertBalanceToCurrencyAsOfDate(const Account *acc, /* for book */
gnc_numeric balance,
gnc_commodity *balance_currency,
gnc_commodity *new_currency,
time_t date)
time64 date)
{
QofBook *book;
GNCPriceDB *pdb;
@ -3262,7 +3262,7 @@ xaccAccountGetXxxBalanceInCurrency (const Account *acc,
}
static gnc_numeric
xaccAccountGetXxxBalanceAsOfDateInCurrency(Account *acc, time_t date,
xaccAccountGetXxxBalanceAsOfDateInCurrency(Account *acc, time64 date,
xaccGetBalanceAsOfDateFn fn,
const gnc_commodity *report_commodity)
{
@ -3286,7 +3286,7 @@ typedef struct
gnc_numeric balance;
xaccGetBalanceFn fn;
xaccGetBalanceAsOfDateFn asOfDateFn;
time_t date;
time64 date;
} CurrencyBalance;
@ -3375,7 +3375,7 @@ xaccAccountGetXxxBalanceInCurrencyRecursive (const Account *acc,
static gnc_numeric
xaccAccountGetXxxBalanceAsOfDateInCurrencyRecursive (
Account *acc, time_t date, xaccGetBalanceAsOfDateFn fn,
Account *acc, time64 date, xaccGetBalanceAsOfDateFn fn,
gnc_commodity *report_commodity, gboolean include_children)
{
gnc_numeric balance;
@ -3466,7 +3466,7 @@ xaccAccountGetProjectedMinimumBalanceInCurrency (
gnc_numeric
xaccAccountGetBalanceAsOfDateInCurrency(
Account *acc, time_t date, gnc_commodity *report_commodity,
Account *acc, time64 date, gnc_commodity *report_commodity,
gboolean include_children)
{
return xaccAccountGetXxxBalanceAsOfDateInCurrencyRecursive (
@ -3475,7 +3475,8 @@ xaccAccountGetBalanceAsOfDateInCurrency(
}
gnc_numeric
xaccAccountGetBalanceChangeForPeriod (Account *acc, time_t t1, time_t t2, gboolean recurse)
xaccAccountGetBalanceChangeForPeriod (Account *acc, time64 t1, time64 t2,
gboolean recurse)
{
gnc_numeric b1, b2;
@ -3992,7 +3993,7 @@ xaccAccountIsPriced(const Account *acc)
\********************************************************************/
gboolean
xaccAccountGetReconcileLastDate (const Account *acc, time_t *last_date)
xaccAccountGetReconcileLastDate (const Account *acc, time64 *last_date)
{
KvpValue *v;
@ -4013,7 +4014,7 @@ xaccAccountGetReconcileLastDate (const Account *acc, time_t *last_date)
\********************************************************************/
void
xaccAccountSetReconcileLastDate (Account *acc, time_t last_date)
xaccAccountSetReconcileLastDate (Account *acc, time64 last_date)
{
if (!acc) return;
@ -4076,7 +4077,7 @@ xaccAccountSetReconcileLastInterval (Account *acc, int months, int days)
\********************************************************************/
gboolean
xaccAccountGetReconcilePostponeDate (const Account *acc, time_t *postpone_date)
xaccAccountGetReconcilePostponeDate (const Account *acc, time64 *postpone_date)
{
KvpValue *v;
@ -4096,7 +4097,7 @@ xaccAccountGetReconcilePostponeDate (const Account *acc, time_t *postpone_date)
\********************************************************************/
void
xaccAccountSetReconcilePostponeDate (Account *acc, time_t postpone_date)
xaccAccountSetReconcilePostponeDate (Account *acc, time64 postpone_date)
{
if (!acc) return;

View File

@ -55,7 +55,7 @@ typedef gnc_numeric (*xaccGetBalanceInCurrencyFn) (
gboolean include_children);
typedef gnc_numeric (*xaccGetBalanceAsOfDateFn) (
Account *account, time_t date);
Account *account, time64 date);
typedef void (*AccountCb)(Account *a, gpointer data);
typedef gpointer (*AccountCb2)(Account *a, gpointer data);
@ -524,7 +524,7 @@ gnc_numeric xaccAccountGetPresentBalance (const Account *account);
gnc_numeric xaccAccountGetProjectedMinimumBalance (const Account *account);
/** Get the balance of the account as of the date specified */
gnc_numeric xaccAccountGetBalanceAsOfDate (Account *account,
time_t date);
time64 date);
/* These two functions convert a given balance from one commodity to
another. The account argument is only used to get the Book, and
@ -543,7 +543,7 @@ gnc_numeric xaccAccountConvertBalanceToCurrency(
gnc_numeric xaccAccountConvertBalanceToCurrencyAsOfDate(
const Account *account, /* for book */
gnc_numeric balance, gnc_commodity *balance_currency,
gnc_commodity *new_currency, time_t date);
gnc_commodity *new_currency, time64 date);
/* These functions get some type of balance in the desired commodity.
'report_commodity' may be NULL to use the account's commodity. */
@ -566,11 +566,11 @@ gnc_numeric xaccAccountGetProjectedMinimumBalanceInCurrency (
/* This function gets the balance as of the given date in the desired
commodity. */
gnc_numeric xaccAccountGetBalanceAsOfDateInCurrency(
Account *account, time_t date, gnc_commodity *report_commodity,
Account *account, time64 date, gnc_commodity *report_commodity,
gboolean include_children);
gnc_numeric xaccAccountGetBalanceChangeForPeriod (
Account *acc, time_t date1, time_t date2, gboolean recurse);
Account *acc, time64 date1, time64 date2, gboolean recurse);
/** @} */
@ -1054,9 +1054,9 @@ LotList * xaccAccountFindOpenLots (const Account *acc,
*/
/** DOCUMENT ME! */
gboolean xaccAccountGetReconcileLastDate (const Account *account,
time_t *last_date);
time64 *last_date);
/** DOCUMENT ME! */
void xaccAccountSetReconcileLastDate (Account *account, time_t last_date);
void xaccAccountSetReconcileLastDate (Account *account, time64 last_date);
/** DOCUMENT ME! */
gboolean xaccAccountGetReconcileLastInterval (const Account *account,
@ -1066,10 +1066,10 @@ void xaccAccountSetReconcileLastInterval (Account *account,
int months, int days);
/** DOCUMENT ME! */
gboolean xaccAccountGetReconcilePostponeDate (const Account *account,
time_t *postpone_date);
time64 *postpone_date);
/** DOCUMENT ME! */
void xaccAccountSetReconcilePostponeDate (Account *account,
time_t postpone_date);
time64 postpone_date);
/** DOCUMENT ME! */
gboolean xaccAccountGetReconcilePostponeBalance (const Account *account,

View File

@ -30,9 +30,6 @@
#include <sys/types.h>
#include <regex.h>
#ifdef HAVE_SYS_TIME_H
# include <sys/time.h>
#endif
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
@ -476,18 +473,18 @@ xaccQueryAddDateMatch(QofQuery * q,
void
xaccQueryAddDateMatchTT(QofQuery * q,
gboolean use_start,
time_t stt,
time64 stt,
gboolean use_end,
time_t ett,
time64 ett,
QofQueryOp op)
{
Timespec sts;
Timespec ets;
sts.tv_sec = (long long)stt;
sts.tv_sec = stt;
sts.tv_nsec = 0;
ets.tv_sec = (long long)ett;
ets.tv_sec = ett;
ets.tv_nsec = 0;
/* gcc -O3 will auto-inline this function, avoiding a call overhead */
@ -498,8 +495,8 @@ xaccQueryAddDateMatchTT(QofQuery * q,
void
xaccQueryGetDateMatchTT (QofQuery * q,
time_t * stt,
time_t * ett)
time64 * stt,
time64 * ett)
{
Timespec sts;
Timespec ets;
@ -594,26 +591,26 @@ xaccQueryAddKVPMatch(QofQuery *q, GSList *path, const KvpValue *value,
* xaccQueryGetEarliestDateFound
*******************************************************************/
time_t
time64
xaccQueryGetEarliestDateFound(QofQuery * q)
{
GList * spl;
Split * sp;
time_t earliest;
time64 earliest;
if (!q) return 0;
spl = qof_query_last_run (q);
if (!spl) return 0;
/* Safe until 2038 on archs where time_t is 32bit */
/* Safe until 2038 on archs where time64 is 32bit */
sp = spl->data;
earliest = (time_t) sp->parent->date_posted.tv_sec;
earliest = sp->parent->date_posted.tv_sec;
for (; spl; spl = spl->next)
{
sp = spl->data;
if (sp->parent->date_posted.tv_sec < earliest)
{
earliest = (time_t) sp->parent->date_posted.tv_sec;
earliest = sp->parent->date_posted.tv_sec;
}
}
return earliest;
@ -623,12 +620,12 @@ xaccQueryGetEarliestDateFound(QofQuery * q)
* xaccQueryGetLatestDateFound
*******************************************************************/
time_t
time64
xaccQueryGetLatestDateFound(QofQuery * q)
{
Split * sp;
GList * spl;
time_t latest = 0;
time64 latest = 0;
if (!q) return 0;
spl = qof_query_last_run (q);
@ -639,7 +636,7 @@ xaccQueryGetLatestDateFound(QofQuery * q)
sp = spl->data;
if (sp->parent->date_posted.tv_sec > latest)
{
latest = (time_t) sp->parent->date_posted.tv_sec;
latest = sp->parent->date_posted.tv_sec;
}
}
return latest;

View File

@ -156,15 +156,15 @@ void xaccQueryAddDateMatchTS(QofQuery * q,
gboolean use_end, Timespec ets,
QofQueryOp op);
void xaccQueryAddDateMatchTT(QofQuery * q,
gboolean use_start, time_t stt,
gboolean use_end, time_t ett,
gboolean use_start, time64 stt,
gboolean use_end, time64 ett,
QofQueryOp op);
void xaccQueryGetDateMatchTS (QofQuery * q,
Timespec * sts,
Timespec * ets);
void xaccQueryGetDateMatchTT (QofQuery * q,
time_t * stt,
time_t * ett);
time64 * stt,
time64 * ett);
typedef enum
{
@ -189,7 +189,7 @@ void xaccQueryAddKVPMatch(QofQuery *q, GSList *path, const KvpValue *value,
/*******************************************************************
* compatibility interface with old QofQuery API
*******************************************************************/
time_t xaccQueryGetEarliestDateFound(QofQuery * q);
time_t xaccQueryGetLatestDateFound(QofQuery * q);
time64 xaccQueryGetEarliestDateFound(QofQuery * q);
time64 xaccQueryGetLatestDateFound(QofQuery * q);
#endif

View File

@ -87,7 +87,7 @@ recurrenceSet(Recurrence *r, guint16 mult, PeriodType pt, const GDate *_start, W
}
else
{
g_date_set_time_t(&r->start, time(NULL));
gnc_gdate_set_today (&r->start);
}
/* Some of the unusual period types also specify phase. For those
@ -377,7 +377,7 @@ recurrenceNthInstance(const Recurrence *r, guint n, GDate *date)
}
}
time_t
time64
recurrenceGetPeriodTime(const Recurrence *r, guint period_num, gboolean end)
{
GDate date;
@ -385,18 +385,18 @@ recurrenceGetPeriodTime(const Recurrence *r, guint period_num, gboolean end)
if (end)
{
g_date_subtract_days(&date, 1);
return gnc_timet_get_day_end_gdate(&date);
return gnc_time64_get_day_end_gdate(&date);
}
else
{
return gnc_timet_get_day_start_gdate(&date);
return gnc_time64_get_day_start_gdate(&date);
}
}
gnc_numeric
recurrenceGetAccountPeriodValue(const Recurrence *r, Account *acc, guint n)
{
time_t t1, t2;
time64 t1, t2;
// FIXME: maybe zero is not best error return val.
g_return_val_if_fail(r && acc, gnc_numeric_zero());

View File

@ -135,7 +135,7 @@ void recurrenceNthInstance(const Recurrence *r, guint n, GDate *date);
/* Get a time coresponding to the beginning (or end if 'end' is true)
of the nth instance of the recurrence. Also zero-based. */
time_t recurrenceGetPeriodTime(const Recurrence *r, guint n, gboolean end);
time64 recurrenceGetPeriodTime(const Recurrence *r, guint n, gboolean end);
/**
* @return the amount that an Account's value changed between the beginning

View File

@ -1111,7 +1111,7 @@ xaccSchedXactionSetTemplateTrans(SchedXaction *sx, GList *t_t_list,
xaccTransSetDescription(new_trans,
gnc_ttinfo_get_description(tti));
xaccTransSetDatePostedSecs(new_trans, time(NULL));
xaccTransSetDatePostedSecs(new_trans, gnc_time (NULL));
xaccTransSetNum(new_trans,
gnc_ttinfo_get_num(tti));

View File

@ -1576,7 +1576,7 @@ xaccSplitSetReconcile (Split *split, char recn)
}
void
xaccSplitSetDateReconciledSecs (Split *split, time_t secs)
xaccSplitSetDateReconciledSecs (Split *split, time64 secs)
{
if (!split) return;
xaccTransBeginEdit (split->parent);

View File

@ -179,8 +179,8 @@ void xaccSplitSetReconcile (Split *split, char reconciled_flag);
char xaccSplitGetReconcile (const Split *split);
/** Set the date on which this split was reconciled by specifying the
* time as time_t. */
void xaccSplitSetDateReconciledSecs (Split *split, time_t time);
* time as time64. */
void xaccSplitSetDateReconciledSecs (Split *split, time64 time);
/** Set the date on which this split was reconciled by specifying the
* time as Timespec. Caller still owns *ts! */
void xaccSplitSetDateReconciledTS (Split *split, Timespec *ts);

View File

@ -224,13 +224,13 @@ xaccTransWriteLog (Transaction *trans, char flag)
if (!gen_logs) return;
if (!trans_log) return;
timespecFromTime_t(&ts, time(NULL));
timespecFromTime64(&ts, gnc_time (NULL));
gnc_timespec_to_iso8601_buff (ts, dnow);
timespecFromTime_t(&ts, trans->date_entered.tv_sec);
timespecFromTime64(&ts, trans->date_entered.tv_sec);
gnc_timespec_to_iso8601_buff (ts, dent);
timespecFromTime_t(&ts, trans->date_posted.tv_sec);
timespecFromTime64(&ts, trans->date_posted.tv_sec);
gnc_timespec_to_iso8601_buff (ts, dpost);
guid_to_string_buff (xaccTransGetGUID(trans), trans_guid_str);
@ -255,7 +255,7 @@ xaccTransWriteLog (Transaction *trans, char flag)
acc_guid_str[0] = '\0';
}
timespecFromTime_t(&ts, split->date_reconciled.tv_sec);
timespecFromTime64(&ts, split->date_reconciled.tv_sec);
gnc_timespec_to_iso8601_buff (ts, drecn);
guid_to_string_buff (xaccSplitGetGUID(split), split_guid_str);

View File

@ -57,6 +57,7 @@ struct timeval
#include "gnc-engine.h"
#include "gnc-lot.h"
#include "gnc-event.h"
#include <gnc-gdate-utils.h>
#include "qofbackend-p.h"
@ -1632,8 +1633,8 @@ xaccTransSetDateInternal(Transaction *trans, Timespec *dadate, Timespec val)
xaccTransBeginEdit(trans);
{
time_t secs = (time_t) val.tv_sec;
gchar *tstr = ctime(&secs);
time64 secs = (time64) val.tv_sec;
gchar *tstr = gnc_ctime (&secs);
PINFO ("addr=%p set date to %" G_GUINT64_FORMAT ".%09ld %s",
trans, val.tv_sec, val.tv_nsec, tstr ? tstr : "(null)");
}
@ -1659,7 +1660,7 @@ set_gains_date_dirty (Transaction *trans)
}
void
xaccTransSetDatePostedSecs (Transaction *trans, time_t secs)
xaccTransSetDatePostedSecs (Transaction *trans, time64 secs)
{
Timespec ts = {secs, 0};
if (!trans) return;
@ -1690,7 +1691,7 @@ xaccTransSetDatePostedGDate (Transaction *trans, GDate date)
}
void
xaccTransSetDateEnteredSecs (Transaction *trans, time_t secs)
xaccTransSetDateEnteredSecs (Transaction *trans, time64 secs)
{
Timespec ts = {secs, 0};
if (!trans) return;
@ -1935,7 +1936,7 @@ xaccTransGetIsClosingTxn (const Transaction *trans)
/********************************************************************\
\********************************************************************/
time_t
time64
xaccTransGetDate (const Transaction *trans)
{
return trans ? trans->date_posted.tv_sec : 0;
@ -2081,7 +2082,7 @@ gboolean xaccTransInFutureByPostedDate (const Transaction *trans)
trans_date = xaccTransGetDatePostedGDate (trans);
g_date_set_time_t (&date_now, time(NULL));
gnc_gdate_set_time64 (&date_now, gnc_time (NULL));
if (g_date_compare (&trans_date, &date_now) > 0)
result = TRUE;
@ -2203,7 +2204,7 @@ xaccTransVoid(Transaction *trans, const char *reason)
kvp_frame_set_string(frame, trans_notes_str, _("Voided transaction"));
kvp_frame_set_string(frame, void_reason_str, reason);
now.tv_sec = time(NULL);
now.tv_sec = gnc_time (NULL);
now.tv_nsec = 0;
gnc_timespec_to_iso8601_buff(now, iso8601_str);
kvp_frame_set_string(frame, void_time_str, iso8601_str);

View File

@ -487,10 +487,10 @@ void xaccTransSetDate (Transaction *trans,
void xaccTransSetDatePostedGDate (Transaction *trans, GDate date);
/** The xaccTransSetDatePostedSecs() method will modify the <i>posted</i>
date of the transaction, specified by a time_t (see ctime(3)). The
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. */
void xaccTransSetDatePostedSecs (Transaction *trans, time_t time);
void xaccTransSetDatePostedSecs (Transaction *trans, time64 time);
/** The xaccTransSetDatePostedTS() method does the same thing as
xaccTransSetDatePostedSecs(), but takes a struct timespec64. */
@ -499,7 +499,7 @@ void xaccTransSetDatePostedTS (Transaction *trans,
/** Modify the date of when the transaction was entered. The entered
* date is the date when the register entry was made. */
void xaccTransSetDateEnteredSecs (Transaction *trans, time_t time);
void xaccTransSetDateEnteredSecs (Transaction *trans, time64 time);
/** Modify the date of when the transaction was entered. The entered
* date is the date when the register entry was made. */
void xaccTransSetDateEnteredTS (Transaction *trans,
@ -512,7 +512,7 @@ void xaccTransSetDateDueTS (Transaction *trans, const Timespec *ts);
the date when this transaction was posted at the bank. (Although
having different function names, GetDate and GetDatePosted refer
to the same single date.)*/
time_t xaccTransGetDate (const Transaction *trans);
time64 xaccTransGetDate (const Transaction *trans);
/** Retrieve the posted date of the transaction. The posted date is
the date when this transaction was posted at the bank. (Although
having different function names, GetDate and GetDatePosted refer

View File

@ -464,7 +464,7 @@ xaccSplitAssignToLot (Split *split, GNCLot *lot)
/* If we are here, then (cmp == +1 iff (amt > baln)) and we need
* to split up the split into pieces. Do it. */
{
time_t now = time(0);
time64 now = gnc_time (NULL);
Split * new_split;
gnc_numeric amt_a, amt_b, amt_tot;
gnc_numeric val_a, val_b, val_tot;
@ -1015,7 +1015,7 @@ xaccSplitComputeCapGains(Split *split, Account *gain_acc)
/* Common to both */
ts = xaccTransRetDatePostedTS (split->parent);
xaccTransSetDatePostedTS (trans, &ts);
xaccTransSetDateEnteredSecs (trans, time(0));
xaccTransSetDateEnteredSecs (trans, gnc_time (NULL));
xaccSplitSetAmount (lot_split, zero);
xaccSplitSetValue (lot_split, value);

View File

@ -94,7 +94,7 @@ gnc_budget_init(GncBudget* budget)
priv->description = CACHE_INSERT("");
priv->num_periods = 12;
g_date_set_time_t(&date, time(NULL));
gnc_gdate_set_today (&date);
g_date_subtract_days(&date, g_date_get_day(&date) - 1);
recurrenceSet(&priv->recurrence, 1, PERIOD_MONTH, &date, WEEKEND_ADJ_NONE);
}
@ -571,8 +571,9 @@ Timespec
gnc_budget_get_period_start_date(const GncBudget *budget, guint period_num)
{
Timespec ts;
timespecFromTime_t(
&ts, recurrenceGetPeriodTime(&GET_PRIVATE(budget)->recurrence, period_num, FALSE));
timespecFromTime64(
&ts, recurrenceGetPeriodTime(&GET_PRIVATE(budget)->recurrence,
period_num, FALSE));
return ts;
}
@ -580,7 +581,7 @@ Timespec
gnc_budget_get_period_end_date(const GncBudget *budget, guint period_num)
{
Timespec ts;
timespecFromTime_t(
timespecFromTime64(
&ts, recurrenceGetPeriodTime(&GET_PRIVATE(budget)->recurrence, period_num, TRUE));
return ts;
}

View File

@ -1304,7 +1304,7 @@ Transaction * gncInvoicePostToAccount (GncInvoice *invoice, Account *acc,
xaccTransSetCurrency (txn, invoice->currency);
/* Entered and Posted at date */
xaccTransSetDateEnteredSecs (txn, time(NULL));
xaccTransSetDateEnteredSecs (txn, gnc_time (NULL));
if (post_date)
{
xaccTransSetDatePostedTS (txn, post_date);

View File

@ -782,7 +782,7 @@ gncOwnerCreatePaymentLot (const GncOwner *owner, Transaction *txn,
xaccTransSetDescription (txn, name ? name : "");
xaccTransSetNum (txn, num);
xaccTransSetCurrency (txn, commodity);
xaccTransSetDateEnteredSecs (txn, time(NULL));
xaccTransSetDateEnteredSecs (txn, gnc_time (NULL));
xaccTransSetDatePostedTS (txn, &date);
xaccTransSetTxnType (txn, TXN_TYPE_PAYMENT);
@ -952,7 +952,7 @@ void gncOwnerAutoApplyPaymentsWithLots (const GncOwner *owner, GList *lots)
xaccTransSetDescription (txn, name ? name : "");
xaccTransSetCurrency (txn, xaccAccountGetCommodity(acct));
xaccTransSetDateEnteredSecs (txn, time(NULL));
xaccTransSetDateEnteredSecs (txn, gnc_time (NULL));
xaccTransSetDatePostedTS (txn, &ts);
xaccTransSetTxnType (txn, TXN_TYPE_LINK);
}

View File

@ -163,7 +163,7 @@ maybe_resort_list (GncTaxTable *table)
static inline void
mod_table (GncTaxTable *table)
{
timespecFromTime_t (&table->modtime, time(NULL));
timespecFromTime64 (&table->modtime, gnc_time (NULL));
}
static inline void addObj (GncTaxTable *table)

View File

@ -57,7 +57,7 @@ run_test (void)
gnc_numeric old_amt, new_amt, old_val, new_val;
QofBook *book;
Timespec ts;
time_t now;
time64 now;
char *reason = "because I can";
@ -91,7 +91,7 @@ run_test (void)
old_amt = xaccSplitGetAmount(xaccTransGetSplit(transaction, 0));
old_val = xaccSplitGetValue(xaccTransGetSplit(transaction, 1));
now = time (NULL);
now = gnc_time (NULL);
xaccTransVoid(transaction, reason);

View File

@ -24,6 +24,7 @@
#include <glib.h>
#include <unittest-support.h>
#include <gnc-event.h>
#include <gnc-gdate-utils.h>
/* Add specific headers for this class */
#include "../Account.h"
#include "../AccountP.h"
@ -344,7 +345,7 @@ setup (Fixture *fixture, gconstpointer pData)
Transaction *txn = xaccMallocTransaction (book);
TxnParms p = t_arr[ind];
GDate *date = g_date_new ();
g_date_set_time_t (date, time (0));
gnc_gdate_set_time64 (date, gnc_time (NULL));
xaccTransBeginEdit (txn);
if (p.desc)
xaccTransSetDescription (txn, p.desc);
@ -1872,7 +1873,7 @@ test_xaccAccountGetProjectedMinimumBalance (Fixture *fixture, gconstpointer pDat
}
/* xaccAccountGetBalanceAsOfDate
gnc_numeric
xaccAccountGetBalanceAsOfDate (Account *acc, time_t date)// C: 12 in 7 SCM: 4 in 4*/
xaccAccountGetBalanceAsOfDate (Account *acc, time64 date)// C: 12 in 7 SCM: 4 in 4*/
static void
test_xaccAccountGetBalanceAsOfDate (Fixture *fixture, gconstpointer pData)
{
@ -1893,7 +1894,8 @@ test_xaccAccountGetBalanceAsOfDate (Fixture *fixture, gconstpointer pData)
}
dbal = gnc_numeric_to_double (bal);
xaccAccountRecomputeBalance (fixture->acct);
val = xaccAccountGetBalanceAsOfDate (fixture->acct, (time (0) - offset));
val = xaccAccountGetBalanceAsOfDate (fixture->acct,
(gnc_time (NULL) - offset));
dval = gnc_numeric_to_double (val);
g_assert_cmpfloat (dval, == , dbal);
}

View File

@ -340,7 +340,7 @@ setup (Fixture *fixture, gconstpointer pData)
Transaction *txn = xaccMallocTransaction (book);
TxnParms p = t_arr[ind];
GDate *date = g_date_new ();
g_date_set_time_t (date, time (0));
gnc_gdate_set_time64 (date, gnc_time (NULL));
xaccTransBeginEdit (txn);
if (p.desc)
xaccTransSetDescription (txn, p.desc);
@ -1868,7 +1868,7 @@ test_xaccAccountGetProjectedMinimumBalance (Fixture *fixture, gconstpointer pDat
}
/* xaccAccountGetBalanceAsOfDate
gnc_numeric
xaccAccountGetBalanceAsOfDate (Account *acc, time_t date)// C: 12 in 7 SCM: 4 in 4*/
xaccAccountGetBalanceAsOfDate (Account *acc, time64 date)// C: 12 in 7 SCM: 4 in 4*/
static void
test_xaccAccountGetBalanceAsOfDate (Fixture *fixture, gconstpointer pData)
{
@ -1889,7 +1889,8 @@ test_xaccAccountGetBalanceAsOfDate (Fixture *fixture, gconstpointer pData)
}
dbal = gnc_numeric_to_double (bal);
xaccAccountRecomputeBalance (fixture->acct);
val = xaccAccountGetBalanceAsOfDate (fixture->acct, (time (0) - offset));
val = xaccAccountGetBalanceAsOfDate (fixture->acct,
(gnc_time (NULL) - offset));
dval = gnc_numeric_to_double (val);
g_assert_cmpfloat (dval, == , dbal);
}