Adding bill term time64 function

This commit is contained in:
lmat 2017-12-31 21:11:29 -05:00 committed by Christopher Lam
parent 6dc982c2c6
commit e6ee060121
3 changed files with 10 additions and 10 deletions

View File

@ -92,7 +92,7 @@ gnc_dialog_date_close_ok_cb (GtkWidget *widget, gpointer user_data)
if (ddc->date)
{
if (ddc->terms)
*(ddc->ts) = gncBillTermComputeDueDate (ddc->terms, *(ddc->ts2));
ddc->ts->tv_sec = gncBillTermComputeDueDate (ddc->terms, ddc->ts2->tv_sec);
else
*(ddc->ts) = gnc_date_edit_get_date_ts (GNC_DATE_EDIT (ddc->date));
}
@ -185,10 +185,10 @@ post_date_changed_cb (GNCDateEdit *gde, gpointer d)
{
DialogDateClose *ddc = d;
Timespec post_date;
Timespec due_date;
Timespec due_date = {0,0};
post_date = gnc_date_edit_get_date_ts (gde);
due_date = gncBillTermComputeDueDate (ddc->terms, post_date);
due_date.tv_sec = gncBillTermComputeDueDate (ddc->terms, post_date.tv_sec);
gnc_date_edit_set_time_ts (GNC_DATE_EDIT (ddc->date), due_date);
}

View File

@ -820,14 +820,14 @@ compute_time (const GncBillTerm *term, Timespec post_date, int days)
return res;
}
Timespec
gncBillTermComputeDueDate (const GncBillTerm *term, Timespec post_date)
time64
gncBillTermComputeDueDate (const GncBillTerm *term, time64 post_date)
{
Timespec res = post_date;
if (!term) return res;
return compute_time (term, post_date, term->due_days);
Timespec pass = {post_date, 0};
if (!term) return post_date;
return compute_time (term, pass, term->due_days).tv_sec;
}
/* Package-Private functions */
static void _gncBillTermCreate (QofBook *book)

View File

@ -164,7 +164,7 @@ gboolean gncBillTermIsFamily (const GncBillTerm *a, const GncBillTerm *b);
/* functions to compute dates from Bill Terms */
/* Compute the due date and discount dates from the post date */
Timespec gncBillTermComputeDueDate (const GncBillTerm *term, Timespec post_date);
time64 gncBillTermComputeDueDate (const GncBillTerm *term, time64 post_date);
/* deprecated */
#define gncBillTermGetGUID(x) qof_instance_get_guid (QOF_INSTANCE(x))