mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Adding some time64 API functions
This commit is contained in:
@@ -2458,6 +2458,12 @@ xaccTransGetDateDueTS (const Transaction *trans, Timespec *ts)
|
||||
xaccTransGetDatePostedTS (trans, ts);
|
||||
}
|
||||
|
||||
time64
|
||||
xaccTransRetDateDueTime64 (const Transaction *trans)
|
||||
{
|
||||
return xaccTransRetDateDueTS (trans).tv_sec;
|
||||
}
|
||||
|
||||
Timespec
|
||||
xaccTransRetDateDueTS (const Transaction *trans)
|
||||
{
|
||||
|
||||
@@ -674,6 +674,7 @@ Timespec xaccTransRetDateEnteredTS (const Transaction *trans);
|
||||
|
||||
/** Dates and txn-type for A/R and A/P "invoice" postings */
|
||||
Timespec xaccTransRetDateDueTS (const Transaction *trans);
|
||||
time64 xaccTransRetDateDueTime64 (const Transaction *trans);
|
||||
/** Dates and txn-type for A/R and A/P "invoice" postings */
|
||||
void xaccTransGetDateDueTS (const Transaction *trans, Timespec *ts);
|
||||
/** @} */
|
||||
|
||||
@@ -208,6 +208,7 @@ SplitList * qof_query_run_subquery (QofQuery *q, const QofQuery *q);
|
||||
%include <gnc-numeric.h>
|
||||
|
||||
Timespec timespecCanonicalDayTime(Timespec t);
|
||||
time64 time64CanonicalDayTime(time64 t);
|
||||
|
||||
%include <gnc-budget.h>
|
||||
|
||||
|
||||
@@ -486,6 +486,15 @@ timespecCanonicalDayTime(Timespec t)
|
||||
return retval;
|
||||
}
|
||||
|
||||
time64
|
||||
time64CanonicalDayTime (time64 t)
|
||||
{
|
||||
struct tm tm;
|
||||
gnc_localtime_r(&t, &tm);
|
||||
gnc_tm_set_day_middle(&tm);
|
||||
return gnc_mktime (&tm);
|
||||
}
|
||||
|
||||
/* NB: month is 1-12, year is 0001 - 9999. */
|
||||
int gnc_date_get_last_mday (int month, int year)
|
||||
{
|
||||
|
||||
@@ -335,6 +335,8 @@ Timespec timespec_abs(const Timespec *t);
|
||||
* returning a Timespec. */
|
||||
Timespec timespecCanonicalDayTime(Timespec t);
|
||||
|
||||
time64 time64CanonicalDayTime(time64 t);
|
||||
|
||||
/** Returns the current clock time as a Timespec, taken from time(2). */
|
||||
Timespec timespec_now (void);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user