Almost completely remove Timespec from import-export.

KvpValue doesn't have a time64 type so aqb-kvp still needs to use
Timespec internally.
This commit is contained in:
John Ralls 2018-07-23 14:39:20 -07:00
parent 1131aa6fc4
commit 9993e0ce29
15 changed files with 98 additions and 90 deletions

View File

@ -51,10 +51,10 @@ struct _DaterangeInfo
gboolean gboolean
gnc_ab_enter_daterange(GtkWidget *parent, gnc_ab_enter_daterange(GtkWidget *parent,
const char *heading, const char *heading,
Timespec *from_date, time64 *from_date,
gboolean *last_retv_date, gboolean *last_retv_date,
gboolean *first_possible_date, gboolean *first_possible_date,
Timespec *to_date, time64 *to_date,
gboolean *to_now) gboolean *to_now)
{ {
GtkBuilder *builder; GtkBuilder *builder;
@ -86,12 +86,12 @@ gnc_ab_enter_daterange(GtkWidget *parent,
now_button = GTK_WIDGET(gtk_builder_get_object (builder, "now_button")); now_button = GTK_WIDGET(gtk_builder_get_object (builder, "now_button"));
info.enter_to_button = GTK_WIDGET(gtk_builder_get_object (builder, "enter_to_button")); info.enter_to_button = GTK_WIDGET(gtk_builder_get_object (builder, "enter_to_button"));
info.from_dateedit = gnc_date_edit_new_ts(*from_date, FALSE, FALSE); info.from_dateedit = gnc_date_edit_new (*from_date, FALSE, FALSE);
gtk_container_add(GTK_CONTAINER(gtk_builder_get_object (builder, "enter_from_box")), gtk_container_add(GTK_CONTAINER(gtk_builder_get_object (builder, "enter_from_box")),
info.from_dateedit); info.from_dateedit);
gtk_widget_show(info.from_dateedit); gtk_widget_show(info.from_dateedit);
info.to_dateedit = gnc_date_edit_new_ts(*to_date, FALSE, FALSE); info.to_dateedit = gnc_date_edit_new (*to_date, FALSE, FALSE);
gtk_container_add(GTK_CONTAINER(gtk_builder_get_object (builder, "enter_to_box")), gtk_container_add(GTK_CONTAINER(gtk_builder_get_object (builder, "enter_to_box")),
info.to_dateedit); info.to_dateedit);
gtk_widget_show(info.to_dateedit); gtk_widget_show(info.to_dateedit);
@ -122,14 +122,12 @@ gnc_ab_enter_daterange(GtkWidget *parent,
if (result == GTK_RESPONSE_OK) if (result == GTK_RESPONSE_OK)
{ {
*from_date = gnc_date_edit_get_date_ts( *from_date = gnc_date_edit_get_date(GNC_DATE_EDIT(info.from_dateedit));
GNC_DATE_EDIT(info.from_dateedit));
*last_retv_date = gtk_toggle_button_get_active( *last_retv_date = gtk_toggle_button_get_active(
GTK_TOGGLE_BUTTON(last_retrieval_button)); GTK_TOGGLE_BUTTON(last_retrieval_button));
*first_possible_date = gtk_toggle_button_get_active( *first_possible_date = gtk_toggle_button_get_active(
GTK_TOGGLE_BUTTON(first_button)); GTK_TOGGLE_BUTTON(first_button));
*to_date = gnc_date_edit_get_date_ts( *to_date = gnc_date_edit_get_date (GNC_DATE_EDIT(info.to_dateedit));
GNC_DATE_EDIT(info.to_dateedit));
*to_now = gtk_toggle_button_get_active( *to_now = gtk_toggle_button_get_active(
GTK_TOGGLE_BUTTON(now_button)); GTK_TOGGLE_BUTTON(now_button));
} }

View File

@ -56,10 +56,10 @@ G_BEGIN_DECLS
*/ */
gboolean gnc_ab_enter_daterange(GtkWidget *parent, gboolean gnc_ab_enter_daterange(GtkWidget *parent,
const char *heading, const char *heading,
Timespec *from_date, time64 *from_date,
gboolean *last_retv_date, gboolean *last_retv_date,
gboolean *first_possible_date, gboolean *first_possible_date,
Timespec *to_date, time64 *to_date,
gboolean *to_now); gboolean *to_now);
G_END_DECLS G_END_DECLS

View File

@ -50,8 +50,7 @@ static gboolean
gettrans_dates(GtkWidget *parent, Account *gnc_acc, gettrans_dates(GtkWidget *parent, Account *gnc_acc,
GWEN_TIME **from_date, GWEN_TIME **to_date) GWEN_TIME **from_date, GWEN_TIME **to_date)
{ {
Timespec last_timespec, until_timespec; time64 last, until;
time64 now = gnc_time (NULL);
gboolean use_last_date = TRUE; gboolean use_last_date = TRUE;
gboolean use_earliest_date = TRUE; gboolean use_earliest_date = TRUE;
gboolean use_until_now = TRUE; gboolean use_until_now = TRUE;
@ -59,19 +58,19 @@ gettrans_dates(GtkWidget *parent, Account *gnc_acc,
g_return_val_if_fail(from_date && to_date, FALSE); g_return_val_if_fail(from_date && to_date, FALSE);
/* Get time of last retrieval */ /* Get time of last retrieval */
last_timespec = gnc_ab_get_account_trans_retrieval(gnc_acc); last = gnc_ab_get_account_trans_retrieval(gnc_acc);
if (last_timespec.tv_sec == 0) if (last == 0)
{ {
use_last_date = FALSE; use_last_date = FALSE;
timespecFromTime64 (&last_timespec, now); last = gnc_time (NULL);
} }
timespecFromTime64 (&until_timespec, now); until = gnc_time (NULL);
/* Let the user choose the date range of retrieval */ /* Let the user choose the date range of retrieval */
if (!gnc_ab_enter_daterange(parent, NULL, if (!gnc_ab_enter_daterange(parent, NULL,
&last_timespec, &last,
&use_last_date, &use_earliest_date, &use_last_date, &use_earliest_date,
&until_timespec, &use_until_now)) &until, &use_until_now))
return FALSE; return FALSE;
/* Now calculate from date */ /* Now calculate from date */
@ -82,14 +81,14 @@ gettrans_dates(GtkWidget *parent, Account *gnc_acc,
else else
{ {
if (use_last_date) if (use_last_date)
last_timespec = gnc_ab_get_account_trans_retrieval(gnc_acc); last = gnc_ab_get_account_trans_retrieval(gnc_acc);
*from_date = GWEN_Time_fromSeconds(timespecToTime64(last_timespec)); *from_date = GWEN_Time_fromSeconds(last);
} }
/* Now calculate to date */ /* Now calculate to date */
if (use_until_now) if (use_until_now)
timespecFromTime64(&until_timespec, now); until = gnc_time (NULL);
*to_date = GWEN_Time_fromSeconds(timespecToTime64(until_timespec)); *to_date = GWEN_Time_fromSeconds(until);
return TRUE; return TRUE;
} }
@ -101,7 +100,7 @@ gnc_ab_gettrans(GtkWidget *parent, Account *gnc_acc)
gboolean online = FALSE; gboolean online = FALSE;
AB_ACCOUNT *ab_acc; AB_ACCOUNT *ab_acc;
GWEN_TIME *from_date = NULL, *to_date = NULL; GWEN_TIME *from_date = NULL, *to_date = NULL;
Timespec until_timespec; time64 until;
AB_JOB *job = NULL; AB_JOB *job = NULL;
AB_JOB_LIST2 *job_list = NULL; AB_JOB_LIST2 *job_list = NULL;
GncGWENGui *gui = NULL; GncGWENGui *gui = NULL;
@ -145,7 +144,7 @@ gnc_ab_gettrans(GtkWidget *parent, Account *gnc_acc)
goto cleanup; goto cleanup;
} }
/* Use this as a local storage for the until_time below. */ /* Use this as a local storage for the until_time below. */
timespecFromTime64(&until_timespec, GWEN_Time_toTime_t(to_date)); until = GWEN_Time_toTime_t(to_date);
/* Get a GetTransactions job and enqueue it */ /* Get a GetTransactions job and enqueue it */
job = AB_JobGetTransactions_new(ab_acc); job = AB_JobGetTransactions_new(ab_acc);
@ -217,7 +216,7 @@ gnc_ab_gettrans(GtkWidget *parent, Account *gnc_acc)
} }
/* Store the date of this retrieval */ /* Store the date of this retrieval */
gnc_ab_set_account_trans_retrieval(gnc_acc, until_timespec); gnc_ab_set_account_trans_retrieval(gnc_acc, until);
cleanup: cleanup:
if (ieci) if (ieci)

View File

@ -95,22 +95,23 @@ gnc_ab_set_account_uid(Account *a, guint32 uid)
xaccAccountCommitEdit(a); xaccAccountCommitEdit(a);
} }
Timespec time64
gnc_ab_get_account_trans_retrieval(const Account *a) gnc_ab_get_account_trans_retrieval(const Account *a)
{ {
Timespec *t = NULL; Timespec *t = NULL;
qof_instance_get (QOF_INSTANCE (a), qof_instance_get (QOF_INSTANCE (a),
"ab-trans-retrieval", &t, "ab-trans-retrieval", &t,
NULL); NULL);
return t ? *t : (Timespec){0, 0}; return t ? t->tv_sec : 0;
} }
void void
gnc_ab_set_account_trans_retrieval(Account *a, Timespec time) gnc_ab_set_account_trans_retrieval(Account *a, time64 time)
{ {
xaccAccountBeginEdit(a); xaccAccountBeginEdit(a);
Timespec ts = {time, 0};
qof_instance_set (QOF_INSTANCE (a), qof_instance_set (QOF_INSTANCE (a),
"ab-trans-retrieval", &time, "ab-trans-retrieval", &ts,
NULL); NULL);
xaccAccountCommitEdit(a); xaccAccountCommitEdit(a);
} }

View File

@ -99,7 +99,7 @@ void gnc_ab_set_account_uid(Account *a, guint32 uid);
* @param a Account * @param a Account
* @return Retrieval time * @return Retrieval time
*/ */
Timespec gnc_ab_get_account_trans_retrieval(const Account *a); time64 gnc_ab_get_account_trans_retrieval(const Account *a);
/** /**
* Set the time of last online transaction retrieval for Account @a a. The * Set the time of last online transaction retrieval for Account @a a. The
@ -108,7 +108,7 @@ Timespec gnc_ab_get_account_trans_retrieval(const Account *a);
* @param a Account * @param a Account
* @param time Retrieval time * @param time Retrieval time
*/ */
void gnc_ab_set_account_trans_retrieval(Account *a, Timespec time); void gnc_ab_set_account_trans_retrieval(Account *a, time64 time);
/** @} */ /** @} */

View File

@ -150,7 +150,6 @@ test_qofsession_aqb_kvp( void )
QofBook *book = qof_session_get_book(new_session); QofBook *book = qof_session_get_book(new_session);
Account* account = gnc_book_get_root_account(book); Account* account = gnc_book_get_root_account(book);
struct tm *retrieved_date, *original_date; struct tm *retrieved_date, *original_date;
gchar buff[MAX_DATE_LENGTH];
g_assert(account); g_assert(account);
@ -158,10 +157,13 @@ test_qofsession_aqb_kvp( void )
// from the xml file? // from the xml file?
if (1) if (1)
{ {
Timespec retrieved_ts = gnc_ab_get_account_trans_retrieval(account); time64 retrieved = gnc_ab_get_account_trans_retrieval(account);
g_test_message("retrieved_ts=%s\n", gnc_print_date(retrieved_ts)); char date_buf [MAX_DATE_LENGTH + 1];
memset (date_buf, 0, sizeof(date_buf));
qof_print_date_buff (date_buf, sizeof(date_buf), retrieved);
g_test_message("retrieved=%s\n", date_buf);
retrieved_date = gnc_gmtime (&retrieved_ts.tv_sec); retrieved_date = gnc_gmtime (&retrieved);
g_assert_cmpint (retrieved_date->tm_year, ==, 114); g_assert_cmpint (retrieved_date->tm_year, ==, 114);
g_assert_cmpint (retrieved_date->tm_mon, ==, 7); g_assert_cmpint (retrieved_date->tm_mon, ==, 7);
g_assert_cmpint (retrieved_date->tm_mday, ==, 29); g_assert_cmpint (retrieved_date->tm_mday, ==, 29);
@ -172,17 +174,23 @@ test_qofsession_aqb_kvp( void )
// Account, just a general Account object. // Account, just a general Account object.
if (1) if (1)
{ {
Timespec original_ts = timespec_now(), retrieved_ts; time64 original = gnc_time (NULL), retrieved;
char date_buf_1 [MAX_DATE_LENGTH + 1];
char date_buf_2 [MAX_DATE_LENGTH + 1];
memset (date_buf_1, 0, sizeof(date_buf_1));
memset (date_buf_2, 0, sizeof(date_buf_2));
// Check whether the "ab-trans-retrieval" property of Account // Check whether the "ab-trans-retrieval" property of Account
// is written and read again correctly. // is written and read again correctly.
gnc_ab_set_account_trans_retrieval(account, original_ts); gnc_ab_set_account_trans_retrieval(account, original);
retrieved_ts = gnc_ab_get_account_trans_retrieval(account); retrieved = gnc_ab_get_account_trans_retrieval(account);
g_test_message("original_ts=%s\n", gnc_print_date(original_ts)); qof_print_date_buff(date_buf_1, sizeof(date_buf_1), original);
g_test_message("retrieved_ts=%s\n", gnc_print_date(retrieved_ts)); qof_print_date_buff(date_buf_2, sizeof(date_buf_2), retrieved);
g_test_message("original_ts=%s\n", date_buf_1);
g_test_message("retrieved_ts=%s\n", date_buf_2);
original_date = gnc_gmtime (&original_ts.tv_sec); original_date = gnc_gmtime (&original);
retrieved_date = gnc_gmtime (&retrieved_ts.tv_sec); retrieved_date = gnc_gmtime (&retrieved);
g_assert_cmpint (retrieved_date->tm_year, ==, original_date->tm_year); g_assert_cmpint (retrieved_date->tm_year, ==, original_date->tm_year);
g_assert_cmpint (retrieved_date->tm_mon, ==, original_date->tm_mon); g_assert_cmpint (retrieved_date->tm_mon, ==, original_date->tm_mon);

View File

@ -148,10 +148,10 @@ add_reconcile_date (gchar *so_far, Split *split, CsvExportInfo *info)
if (xaccSplitGetReconcile (split) == YREC) if (xaccSplitGetReconcile (split) == YREC)
{ {
Timespec ts = {0,0}; char str_rec_date[MAX_DATE_LENGTH + 1];
const gchar *str_rec_date; memset (str_rec_date, 0, sizeof(str_rec_date));
xaccSplitGetDateReconciledTS (split, &ts); time64 t = xaccSplitGetDateReconciled (split);
str_rec_date = gnc_print_date (ts); qof_print_date_buff (str_rec_date, sizeof(str_rec_date), t);
result = g_strconcat (so_far, str_rec_date, info->mid_sep, NULL); result = g_strconcat (so_far, str_rec_date, info->mid_sep, NULL);
} }
else else

View File

@ -251,15 +251,14 @@ Result GncImportPrice::create_price (QofBook* book, GNCPriceDB *pdb, bool over)
return FAILED; return FAILED;
} }
Timespec date; auto date = static_cast<time64>(GncDateTime(*m_date, DayPart::neutral));
timespecFromTime64 (&date, static_cast<time64>(GncDateTime(*m_date, DayPart::neutral)));
date.tv_nsec = 0;
bool rev = false; bool rev = false;
auto amount = *m_amount; auto amount = *m_amount;
Result ret_val = ADDED; Result ret_val = ADDED;
GNCPrice *old_price = gnc_pricedb_lookup_day (pdb, *m_from_commodity, *m_to_currency, date); GNCPrice *old_price = gnc_pricedb_lookup_day_t64 (pdb, *m_from_commodity,
*m_to_currency, date);
// Should old price be over writen // Should old price be over writen
if ((old_price != nullptr) && (over == true)) if ((old_price != nullptr) && (over == true))
@ -287,10 +286,14 @@ Result GncImportPrice::create_price (QofBook* book, GNCPriceDB *pdb, bool over)
rev = true; rev = true;
} }
DEBUG("Date is %s, Rev is %d, Commodity from is '%s', Currency is '%s', Amount is %s", gnc_print_date (date), char date_str [MAX_DATE_LENGTH + 1];
rev, gnc_commodity_get_fullname (*m_from_commodity), gnc_commodity_get_fullname (*m_to_currency), memset (date_str, 0, sizeof(date_str));
amount.to_string().c_str()); qof_print_date_buff (date_str, sizeof(date_str), date);
DEBUG("Date is %s, Rev is %d, Commodity from is '%s', Currency is '%s', "
"Amount is %s", date_str, rev,
gnc_commodity_get_fullname (*m_from_commodity),
gnc_commodity_get_fullname (*m_to_currency),
amount.to_string().c_str());
// Create the new price // Create the new price
if (old_price == nullptr) if (old_price == nullptr)
{ {
@ -311,7 +314,7 @@ Result GncImportPrice::create_price (QofBook* book, GNCPriceDB *pdb, bool over)
auto amount_conv = amount.convert<RoundType::half_up>(CURRENCY_DENOM); auto amount_conv = amount.convert<RoundType::half_up>(CURRENCY_DENOM);
gnc_price_set_value (price, static_cast<gnc_numeric>(amount_conv)); gnc_price_set_value (price, static_cast<gnc_numeric>(amount_conv));
gnc_price_set_time (price, date); gnc_price_set_time64 (price, date);
gnc_price_set_source (price, PRICE_SOURCE_USER_PRICE); gnc_price_set_source (price, PRICE_SOURCE_USER_PRICE);
//FIXME Not sure which one gnc_price_set_source (price, PRICE_SOURCE_FQ); //FIXME Not sure which one gnc_price_set_source (price, PRICE_SOURCE_FQ);
gnc_price_set_typestr (price, PRICE_TYPE_LAST); gnc_price_set_typestr (price, PRICE_TYPE_LAST);

View File

@ -556,10 +556,11 @@ static void trans_add_split (Transaction* trans, Account* account, GncNumeric am
value = amount * *price; value = amount * *price;
else else
{ {
Timespec ts = {xaccTransRetDatePosted (trans), 0}; auto time = xaccTransRetDatePosted (trans);
/* Import data didn't specify price, let's lookup the nearest in time */ /* Import data didn't specify price, let's lookup the nearest in time */
auto nprice = gnc_pricedb_lookup_nearest_in_time(gnc_pricedb_get_db(book), auto nprice =
acct_comm, trans_curr, ts); gnc_pricedb_lookup_nearest_in_time64(gnc_pricedb_get_db(book),
acct_comm, trans_curr, time);
if (nprice) if (nprice)
{ {
/* Found a usable price. Let's check if the conversion direction is right */ /* Found a usable price. Let's check if the conversion direction is right */

View File

@ -292,7 +292,7 @@ fix_year(int y)
} }
gboolean gboolean
gnc_import_parse_date(const char *str, GncImportFormat fmt, Timespec *val) gnc_import_parse_date(const char *str, GncImportFormat fmt, time64 *val)
{ {
regmatch_t match[5]; regmatch_t match[5];
char temp[9]; char temp[9];
@ -405,7 +405,7 @@ gnc_import_parse_date(const char *str, GncImportFormat fmt, Timespec *val)
return FALSE; return FALSE;
y = fix_year(y); y = fix_year(y);
*val = gnc_dmy2timespec(d, m, y); *val = gnc_dmy2time64(d, m, y);
return TRUE; return TRUE;
} }

View File

@ -55,7 +55,7 @@ GncImportFormat gnc_import_choose_fmt(const char* msg, GncImportFormat fmts,
gboolean gnc_import_parse_numeric(const char* str, GncImportFormat fmt, gboolean gnc_import_parse_numeric(const char* str, GncImportFormat fmt,
gnc_numeric *val); gnc_numeric *val);
gboolean gnc_import_parse_date(const char *date, GncImportFormat fmt, gboolean gnc_import_parse_date(const char *date, GncImportFormat fmt,
Timespec *val); time64 *val);
/* Set and clear flags in bit-flags */ /* Set and clear flags in bit-flags */
#define import_set_flag(i,f) (i |= f) #define import_set_flag(i,f) (i |= f)

View File

@ -71,11 +71,11 @@ typedef struct _split_record
int trans_guid_present; int trans_guid_present;
GncGUID split_guid; GncGUID split_guid;
int split_guid_present; int split_guid_present;
Timespec log_date; time64 log_date;
int log_date_present; int log_date_present;
Timespec date_entered; time64 date_entered;
int date_entered_present; int date_entered_present;
Timespec date_posted; time64 date_posted;
int date_posted_present; int date_posted_present;
GncGUID acc_guid; GncGUID acc_guid;
int acc_guid_present; int acc_guid_present;
@ -97,7 +97,7 @@ typedef struct _split_record
int amount_present; int amount_present;
gnc_numeric value; gnc_numeric value;
int value_present; int value_present;
Timespec date_reconciled; time64 date_reconciled;
int date_reconciled_present; int date_reconciled_present;
} split_record; } split_record;
/********************************************************************\ /********************************************************************\
@ -181,20 +181,17 @@ static split_record interpret_split_record( char *record_line)
} }
if (strlen(tok_ptr = my_strtok(NULL, "\t")) != 0) if (strlen(tok_ptr = my_strtok(NULL, "\t")) != 0)
{ {
time64 secs = gnc_iso8601_to_time64_gmt(tok_ptr); record.log_date = gnc_iso8601_to_time64_gmt(tok_ptr);
record.log_date.tv_sec = secs;
record.log_date_present = TRUE; record.log_date_present = TRUE;
} }
if (strlen(tok_ptr = my_strtok(NULL, "\t")) != 0) if (strlen(tok_ptr = my_strtok(NULL, "\t")) != 0)
{ {
time64 secs = gnc_iso8601_to_time64_gmt(tok_ptr); record.date_entered = gnc_iso8601_to_time64_gmt(tok_ptr);
record.date_entered.tv_sec = secs;
record.date_entered_present = TRUE; record.date_entered_present = TRUE;
} }
if (strlen(tok_ptr = my_strtok(NULL, "\t")) != 0) if (strlen(tok_ptr = my_strtok(NULL, "\t")) != 0)
{ {
time64 secs = gnc_iso8601_to_time64_gmt(tok_ptr); record.date_posted = gnc_iso8601_to_time64_gmt(tok_ptr);
record.date_posted.tv_sec = secs;
record.date_posted_present = TRUE; record.date_posted_present = TRUE;
} }
if (strlen(tok_ptr = my_strtok(NULL, "\t")) != 0) if (strlen(tok_ptr = my_strtok(NULL, "\t")) != 0)
@ -249,8 +246,7 @@ static split_record interpret_split_record( char *record_line)
} }
if (strlen(tok_ptr = my_strtok(NULL, "\t")) != 0) if (strlen(tok_ptr = my_strtok(NULL, "\t")) != 0)
{ {
time64 secs = gnc_iso8601_to_time64_gmt(tok_ptr); record.date_reconciled = gnc_iso8601_to_time64_gmt(tok_ptr);
record.date_reconciled.tv_sec = secs;
record.date_reconciled_present = TRUE; record.date_reconciled_present = TRUE;
} }
@ -298,17 +294,17 @@ static void dump_split_record(split_record record)
} }
if (record.log_date_present) if (record.log_date_present)
{ {
gnc_timespec_to_iso8601_buff (record.log_date, string_buf); gnc_time64_to_iso8601_buff (record.log_date, string_buf);
DEBUG("Log entry date: %s", string_buf); DEBUG("Log entry date: %s", string_buf);
} }
if (record.date_entered_present) if (record.date_entered_present)
{ {
gnc_timespec_to_iso8601_buff (record.date_entered, string_buf); gnc_time64_to_iso8601_buff (record.date_entered, string_buf);
DEBUG("Date entered: %s", string_buf); DEBUG("Date entered: %s", string_buf);
} }
if (record.date_posted_present) if (record.date_posted_present)
{ {
gnc_timespec_to_iso8601_buff (record.date_posted, string_buf); gnc_time64_to_iso8601_buff (record.date_posted, string_buf);
DEBUG("Date posted: %s", string_buf); DEBUG("Date posted: %s", string_buf);
} }
if (record.acc_guid_present) if (record.acc_guid_present)
@ -358,7 +354,7 @@ static void dump_split_record(split_record record)
} }
if (record.date_reconciled_present) if (record.date_reconciled_present)
{ {
gnc_timespec_to_iso8601_buff (record.date_reconciled, string_buf); gnc_time64_to_iso8601_buff (record.date_reconciled, string_buf);
DEBUG("Reconciled date: %s", string_buf); DEBUG("Reconciled date: %s", string_buf);
} }
} }
@ -452,11 +448,11 @@ static void process_trans_record( FILE *log_file)
/*Fill the transaction info*/ /*Fill the transaction info*/
if (record.date_entered_present) if (record.date_entered_present)
{ {
xaccTransSetDateEnteredSecs(trans, record.date_entered.tv_sec); xaccTransSetDateEnteredSecs(trans, record.date_entered);
} }
if (record.date_posted_present) if (record.date_posted_present)
{ {
xaccTransSetDatePostedSecs(trans, record.date_posted.tv_sec); xaccTransSetDatePostedSecs(trans, record.date_posted);
} }
if (record.trans_num_present) if (record.trans_num_present)
{ {
@ -510,7 +506,7 @@ static void process_trans_record( FILE *log_file)
} }
if (record.date_reconciled_present) if (record.date_reconciled_present)
{ {
xaccSplitSetDateReconciledTS (split, &(record.date_reconciled)); xaccSplitSetDateReconciledSecs (split, record.date_reconciled);
} }
if (record.split_reconcile_present) if (record.split_reconcile_present)
{ {

View File

@ -503,9 +503,8 @@ int ofx_proc_transaction_cb(struct OfxTransactionData data, void *user_data)
} }
if (data.date_funds_available_valid) if (data.date_funds_available_valid)
{ {
Timespec ts; time64 time = data.date_funds_available;
timespecFromTime64(&ts, data.date_funds_available); gnc_time64_to_iso8601_buff (time, dest_string);
gnc_timespec_to_iso8601_buff (ts, dest_string);
tmp = notes; tmp = notes;
notes = g_strdup_printf("%s%s%s", tmp, notes = g_strdup_printf("%s%s%s", tmp,
"|Date funds available:", dest_string); "|Date funds available:", dest_string);

View File

@ -3137,7 +3137,9 @@ gnc_ui_qif_import_duplicates_match_prepare (GtkAssistant *assistant,
duplicates = wind->match_transactions; duplicates = wind->match_transactions;
while (!scm_is_null(duplicates)) while (!scm_is_null(duplicates))
{ {
Timespec send_ts = {0,0}; time64 send_time = 0;
char date_buf[MAX_DATE_LENGTH + 1];
memset (date_buf, 0, sizeof(date_buf));
current_xtn = SCM_CAAR(duplicates); current_xtn = SCM_CAAR(duplicates);
#define FUNC_NAME "xaccTransCountSplits" #define FUNC_NAME "xaccTransCountSplits"
gnc_xtn = SWIG_MustGetPtr(current_xtn, gnc_xtn = SWIG_MustGetPtr(current_xtn,
@ -3154,12 +3156,13 @@ gnc_ui_qif_import_duplicates_match_prepare (GtkAssistant *assistant,
(xaccSplitGetAccount(gnc_split), TRUE)); (xaccSplitGetAccount(gnc_split), TRUE));
} }
gtk_list_store_append(store, &iter); gtk_list_store_append(store, &iter);
send_ts.tv_sec = xaccTransRetDatePosted(gnc_xtn); send_time = xaccTransRetDatePosted(gnc_xtn);
qof_print_date_buff (date_buf, sizeof(date_buf), send_time);
gtk_list_store_set gtk_list_store_set
(store, &iter, (store, &iter,
QIF_TRANS_COL_INDEX, rownum++, QIF_TRANS_COL_INDEX, rownum++,
QIF_TRANS_COL_DATE, QIF_TRANS_COL_DATE,
gnc_print_date(send_ts), date_buf,
QIF_TRANS_COL_DESCRIPTION, xaccTransGetDescription(gnc_xtn), QIF_TRANS_COL_DESCRIPTION, xaccTransGetDescription(gnc_xtn),
QIF_TRANS_COL_AMOUNT, amount_str, QIF_TRANS_COL_AMOUNT, amount_str,
-1); -1);

View File

@ -137,11 +137,11 @@ test_parse_numeric(void)
static void static void
test_date(const char* str, GncImportFormat fmt, my_ymd_t date) test_date(const char* str, GncImportFormat fmt, my_ymd_t date)
{ {
Timespec ts, ts2;; time64 t1, t2;
do_test(gnc_import_parse_date(str, fmt, &ts), "Parsing date"); do_test(gnc_import_parse_date(str, fmt, &t1), "Parsing date");
ts2 = gnc_dmy2timespec(date.d, date.m, date.y); t2 = gnc_dmy2time64(date.d, date.m, date.y);
do_test(timespec_equal(&ts, &ts2), "Date Equal"); do_test(t1 == t2, "Date Equal");
} }
static void static void