timespec->time64 for gnc_budget_get_period...

This commit is contained in:
lmat 2017-12-01 16:17:42 -05:00 committed by Christopher Lam
parent 95e31f982b
commit 2f89e4595b
3 changed files with 10 additions and 17 deletions

View File

@ -591,25 +591,18 @@ gnc_budget_get_account_period_value(const GncBudget *budget,
}
Timespec
time64
gnc_budget_get_period_start_date(const GncBudget *budget, guint period_num)
{
Timespec ts = {0, 0};
g_return_val_if_fail (GNC_IS_BUDGET(budget), ts);
timespecFromTime64(
&ts, recurrenceGetPeriodTime(&GET_PRIVATE(budget)->recurrence,
period_num, FALSE));
return ts;
g_return_val_if_fail (GNC_IS_BUDGET(budget), 0);
return recurrenceGetPeriodTime(&GET_PRIVATE(budget)->recurrence, period_num, FALSE);
}
Timespec
time64
gnc_budget_get_period_end_date(const GncBudget *budget, guint period_num)
{
Timespec ts = {0, 0};
g_return_val_if_fail (GNC_IS_BUDGET(budget), ts);
timespecFromTime64(
&ts, recurrenceGetPeriodTime(&GET_PRIVATE(budget)->recurrence, period_num, TRUE));
return ts;
g_return_val_if_fail (GNC_IS_BUDGET(budget), 0);
return recurrenceGetPeriodTime(&GET_PRIVATE(budget)->recurrence, period_num, TRUE);
}
gnc_numeric

View File

@ -131,10 +131,10 @@ void gnc_budget_set_recurrence(GncBudget *budget, const Recurrence *r);
const Recurrence * gnc_budget_get_recurrence(const GncBudget *budget);
/** Get the starting date of the Budget period*/
Timespec gnc_budget_get_period_start_date(const GncBudget* budget, guint period_num);
time64 gnc_budget_get_period_start_date(const GncBudget* budget, guint period_num);
/** Get the ending date of the Budget period*/
Timespec gnc_budget_get_period_end_date(const GncBudget* budget, guint period_num);
time64 gnc_budget_get_period_end_date(const GncBudget* budget, guint period_num);
/* Period indices are zero-based. */
void gnc_budget_set_account_period_value(

View File

@ -2533,8 +2533,8 @@ test_gnc_set_budget_recurrence()
for (i = 0; i < 12; ++i)
{
period_start = timespec_to_gdate(gnc_budget_get_period_start_date(budget, i));
period_end = timespec_to_gdate(gnc_budget_get_period_end_date(budget, i));
period_start = time64_to_gdate(gnc_budget_get_period_start_date(budget, i));
period_end = time64_to_gdate(gnc_budget_get_period_end_date(budget, i));
g_assert_cmpint(g_date_get_day(&period_start), ==, 1);
g_assert_cmpint(g_date_get_day(&period_end), ==, period_info[i].end_day);