mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-20 11:48:30 -06:00
Use time64 GncDateTime constructor instead of struct tm constructor.
It's substantially faster and we do a lot of time64->gdate conversions.
This commit is contained in:
parent
f7ce8bcbb3
commit
71e3703087
@ -1336,11 +1336,12 @@ timespecToTime64 (Timespec ts)
|
||||
GDate timespec_to_gdate (Timespec ts)
|
||||
{
|
||||
GDate result;
|
||||
gint day, month, year;
|
||||
|
||||
g_date_clear (&result, 1);
|
||||
gnc_timespec2dmy (ts, &day, &month, &year);
|
||||
g_date_set_dmy (&result, day, static_cast<GDateMonth>(month), year);
|
||||
GncDateTime time(ts.tv_sec);
|
||||
auto date = time.date().year_month_day();
|
||||
g_date_set_dmy (&result, date.day, static_cast<GDateMonth>(date.month),
|
||||
date.year);
|
||||
g_assert(g_date_valid (&result));
|
||||
|
||||
return result;
|
||||
|
Loading…
Reference in New Issue
Block a user