diff --git a/src/engine/Query.c b/src/engine/Query.c index 202d8452f6..180c057162 100644 --- a/src/engine/Query.c +++ b/src/engine/Query.c @@ -80,6 +80,7 @@ xaccMallocQuery (void) static int Sort_DATE_NUM_AMOUNT (Split **, Split **); #define LONG_LONG_MAX 0x7fffffffffffffffLL +#define LONG_LONG_MIN (- (0x7fffffffffffffffLL) -1) void xaccInitQuery (Query *q) @@ -91,7 +92,7 @@ xaccInitQuery (Query *q) q->changed = 0; q->max_num_splits = INT_MAX ; - q->earliest.tv_sec = - (LONG_LONG_MAX) - 1; + q->earliest.tv_sec = LONG_LONG_MIN; q->earliest.tv_nsec = 0; /* Its a signed, 64-bit int */ @@ -101,7 +102,7 @@ xaccInitQuery (Query *q) q->earliest_found.tv_sec = LONG_LONG_MAX; q->earliest_found.tv_nsec = 0; - q->latest_found.tv_sec = - (LONG_LONG_MAX) - 1; + q->latest_found.tv_sec = LONG_LONG_MIN; q->latest_found.tv_nsec = 0; q->sort_func = (int (*)(const void*, const void *)) Sort_DATE_NUM_AMOUNT; @@ -203,7 +204,7 @@ xaccQuerySetMaxSplits (Query *q, int max) /* ================================================== */ void -xaccQuerySetDateRange (Query *q, time_t early, time_t late) +xaccQuerySetDateRange (Query *q, long long early, long long late) { if (!q) return; q->changed = 1; diff --git a/src/engine/Query.h b/src/engine/Query.h index e1f0255b75..d5588472f4 100644 --- a/src/engine/Query.h +++ b/src/engine/Query.h @@ -61,10 +61,11 @@ void xaccQueryAddAccount (Query *, Account *acc); void xaccQuerySetMaxSplits (Query *, int); /* The xaccQuerySetDateRange() method sets the date range - * for the query. Thje query will return only those splits - * that are within this date range. + * for the query. The query will return only those splits + * that are within this date range. The arguments "earliest" + * and "latest" are seconds before or since 00:00:00 Jan 1 1970. */ -void xaccQuerySetDateRange (Query *, time_t earliest, time_t latest); +void xaccQuerySetDateRange (Query *, long long earliest, long long latest); /* The xaccQuerySetSortOrder() method sets the sort order that * should be used on the splits. The three arguments should diff --git a/src/engine/Transaction.c b/src/engine/Transaction.c index cd260e3151..925ad8ba2b 100644 --- a/src/engine/Transaction.c +++ b/src/engine/Transaction.c @@ -1511,7 +1511,7 @@ xaccTransSetDateEnteredTS (Transaction *trans, Timespec *ts) trans->date_entered.tv_nsec = ts->tv_nsec; } -#define THIRTY_TWO_YEARS 0x3c30fc00L +#define THIRTY_TWO_YEARS 0x3c30fc00LL void xaccTransSetDate (Transaction *trans, int day, int mon, int year)