Some time64 corrections

The build system isn't always catching changed files, so these showed up
later.
This commit is contained in:
lmat 2017-12-31 09:38:45 -05:00 committed by Christopher Lam
parent 1f050fd1e5
commit 6dc982c2c6
4 changed files with 28 additions and 22 deletions

View File

@ -524,7 +524,7 @@ gnc_bi_import_create_bis (GtkListStore * store, QofBook * book,
Account *acc = NULL;
enum update {YES = GTK_RESPONSE_YES, NO = GTK_RESPONSE_NO} update;
GtkWidget *dialog;
Timespec today;
time64 today;
InvoiceWindow *iw;
gchar *new_id = NULL;
gint64 denom = 0;
@ -612,14 +612,12 @@ gnc_bi_import_create_bis (GtkListStore * store, QofBook * book,
// FIXME: Must check for the return value of qof_scan_date!
qof_scan_date (date_opened, &day, &month, &year);
gncInvoiceSetDateOpened (invoice,
gnc_dmy2timespec (day, month, year));
gnc_dmy2time64 (day, month, year));
}
else // If no date in CSV
{
time64 now = gnc_time (NULL);
Timespec now_timespec;
timespecFromTime64 (&now_timespec, now);
gncInvoiceSetDateOpened (invoice, now_timespec);
gncInvoiceSetDateOpened (invoice, now);
}
gncInvoiceSetBillingID (invoice, billing_id ? billing_id : "");
notes = un_escape(notes);
@ -697,17 +695,17 @@ gnc_bi_import_create_bis (GtkListStore * store, QofBook * book,
gncEntrySetDateGDate (entry, date);
g_date_free (date);
}
timespecFromTime64 (&today, gnc_time (NULL)); // set today to the current date
today = gnc_time (NULL); // set today to the current date
if (strlen (date) != 0) // If a date is specified in CSV
{
GDate *date = g_date_new_dmy(day, month, year);
gncEntrySetDateGDate(entry, date);
gncEntrySetDateEntered(entry, gnc_dmy2timespec (day, month, year));
gncEntrySetDateEntered(entry, gnc_dmy2time64 (day, month, year));
}
else
{
GDate *date = gnc_g_date_new_today();
gncEntrySetDateGDate(entry, date); // TODO: DEPRECATED - use gncEntrySetDateGDate() instead!
gncEntrySetDateGDate(entry, date);
gncEntrySetDateEntered(entry, today);
}
// Remove escaped quotes
@ -772,7 +770,7 @@ gnc_bi_import_create_bis (GtkListStore * store, QofBook * book,
// autopost this invoice
GHashTable *foreign_currs;
gboolean auto_pay;
Timespec p_date, d_date;
time64 p_date, d_date;
guint curr_count;
gboolean scan_date_r;
scan_date_r = qof_scan_date (date_posted, &day, &month, &year);
@ -789,11 +787,11 @@ gnc_bi_import_create_bis (GtkListStore * store, QofBook * book,
// Only auto-post if there's a single currency involved
if(curr_count == 0)
{
p_date = gnc_dmy2timespec (day, month, year);
p_date = gnc_dmy2time64 (day, month, year);
// Check for the return value of qof_scan_date
if(qof_scan_date (due_date, &day, &month, &year)) // obtains the due date, or leaves it at date_posted
{
d_date = gnc_dmy2timespec (day, month, year);
d_date = gnc_dmy2time64 (day, month, year);
}
else
d_date = p_date;
@ -804,7 +802,7 @@ gnc_bi_import_create_bis (GtkListStore * store, QofBook * book,
// Check if the currencies match
if(gncInvoiceGetCurrency(invoice) == gnc_account_get_currency_or_parent(acc))
{
gncInvoicePostToAccount (invoice, acc, &p_date, &d_date,
gncInvoicePostToAccount (invoice, acc, p_date, d_date,
memo_posted,
text2bool (accumulatesplits),
auto_pay);

View File

@ -181,17 +181,20 @@ static split_record interpret_split_record( char *record_line)
}
if (strlen(tok_ptr = my_strtok(NULL, "\t")) != 0)
{
record.log_date = gnc_iso8601_to_timespec_gmt(tok_ptr);
time64 secs = gnc_iso8601_to_time64_gmt(tok_ptr);
record.log_date.tv_sec = secs;
record.log_date_present = TRUE;
}
if (strlen(tok_ptr = my_strtok(NULL, "\t")) != 0)
{
record.date_entered = gnc_iso8601_to_timespec_gmt(tok_ptr);
time64 secs = gnc_iso8601_to_time64_gmt(tok_ptr);
record.date_entered.tv_sec = secs;
record.date_entered_present = TRUE;
}
if (strlen(tok_ptr = my_strtok(NULL, "\t")) != 0)
{
record.date_posted = gnc_iso8601_to_timespec_gmt(tok_ptr);
time64 secs = gnc_iso8601_to_time64_gmt(tok_ptr);
record.date_posted.tv_sec = secs;
record.date_posted_present = TRUE;
}
if (strlen(tok_ptr = my_strtok(NULL, "\t")) != 0)
@ -246,7 +249,8 @@ static split_record interpret_split_record( char *record_line)
}
if (strlen(tok_ptr = my_strtok(NULL, "\t")) != 0)
{
record.date_reconciled = gnc_iso8601_to_timespec_gmt(tok_ptr);
time64 secs = gnc_iso8601_to_time64_gmt(tok_ptr);
record.date_reconciled.tv_sec = secs;
record.date_reconciled_present = TRUE;
}
@ -446,11 +450,11 @@ static void process_trans_record( FILE *log_file)
/*Fill the transaction info*/
if (record.date_entered_present)
{
xaccTransSetDateEnteredTS(trans, &(record.date_entered));
xaccTransSetDateEnteredSecs(trans, record.date_entered.tv_sec);
}
if (record.date_posted_present)
{
xaccTransSetDatePostedTS(trans, &(record.date_posted));
xaccTransSetDatePostedSecs(trans, record.date_posted.tv_sec);
}
if (record.trans_num_present)
{

View File

@ -1131,6 +1131,7 @@ refresh_old_transactions(QIFImportWindow * wind, int selection)
while (!scm_is_null(possible_matches))
{
Timespec ts_send = {0,0};
current_xtn = SCM_CAR(possible_matches);
#define FUNC_NAME "xaccTransCountSplits"
gnc_xtn = SWIG_MustGetPtr(SCM_CAR(current_xtn),
@ -1152,10 +1153,11 @@ refresh_old_transactions(QIFImportWindow * wind, int selection)
}
gtk_list_store_append(store, &iter);
ts_send.tv_sec = xaccTransRetDatePosted(gnc_xtn);
gtk_list_store_set
(store, &iter,
QIF_TRANS_COL_INDEX, rownum++,
QIF_TRANS_COL_DATE, gnc_print_date(xaccTransRetDatePostedTS(gnc_xtn)),
QIF_TRANS_COL_DATE, gnc_print_date(ts_send),
QIF_TRANS_COL_DESCRIPTION, xaccTransGetDescription(gnc_xtn),
QIF_TRANS_COL_AMOUNT, amount_str,
QIF_TRANS_COL_CHECKED, selected != SCM_BOOL_F,
@ -3122,6 +3124,7 @@ gnc_ui_qif_import_duplicates_match_prepare (GtkAssistant *assistant,
duplicates = wind->match_transactions;
while (!scm_is_null(duplicates))
{
Timespec send_ts = {0,0};
current_xtn = SCM_CAAR(duplicates);
#define FUNC_NAME "xaccTransCountSplits"
gnc_xtn = SWIG_MustGetPtr(current_xtn,
@ -3138,11 +3141,12 @@ gnc_ui_qif_import_duplicates_match_prepare (GtkAssistant *assistant,
(xaccSplitGetAccount(gnc_split), TRUE));
}
gtk_list_store_append(store, &iter);
send_ts.tv_sec = xaccTransRetDatePosted(gnc_xtn);
gtk_list_store_set
(store, &iter,
QIF_TRANS_COL_INDEX, rownum++,
QIF_TRANS_COL_DATE,
gnc_print_date(xaccTransRetDatePostedTS(gnc_xtn)),
gnc_print_date(send_ts),
QIF_TRANS_COL_DESCRIPTION, xaccTransGetDescription(gnc_xtn),
QIF_TRANS_COL_AMOUNT, amount_str,
-1);

View File

@ -379,8 +379,8 @@ Timespec gnc_dmy2timespec_end (gint day, gint month, gint year);
*/
Timespec gnc_dmy2timespec_neutral (gint day, gint month, gint year);
/** The gnc_iso8601_to_timespec_gmt() routine converts an ISO-8601 style
* date/time string to Timespec. Please note that ISO-8601 strings
/** The gnc_iso8601_to_time64_gmt() routine converts an ISO-8601 style
* date/time string to time64. Please note that ISO-8601 strings
* are a representation of Universal Time (UTC), and as such, they
* 'store' UTC. To make them human readable, they show time zone
* information along with a local-time string. But fundamentally,