mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Fix wrong date of beginning of epoch.
This commit is contained in:
@@ -655,7 +655,7 @@ gnc_date_edit_class_init (GNCDateEditClass *klass)
|
||||
PROP_TIME,
|
||||
g_param_spec_int64("time",
|
||||
"Date/time (seconds)",
|
||||
"Date/time represented in seconds since Januari 31st, 1970",
|
||||
"Date/time represented in seconds since midnight UTC, 1 January 1970",
|
||||
G_MININT64,
|
||||
G_MAXINT64,
|
||||
0,
|
||||
|
||||
@@ -93,13 +93,27 @@ struct _GncABImExContextImport
|
||||
GData *tmp_job_list;
|
||||
};
|
||||
|
||||
static inline is_leap_year (int year)
|
||||
{
|
||||
return (year % 400 == 0 || (year % 4 == 0 && year % 100 != 0 ));
|
||||
}
|
||||
|
||||
static inline time64
|
||||
gnc_gwen_date_to_time64 (const GNC_GWEN_DATE* date)
|
||||
{
|
||||
#if AQBANKING_VERSION_INT >= 59900
|
||||
return gnc_dmy2time64_neutral(GWEN_Date_GetDay(date),
|
||||
GWEN_Date_GetMonth(date),
|
||||
GWEN_Date_GetYear(date));
|
||||
int day = GWEN_Date_GetDay(date);
|
||||
int month = GWEN_Date_GetMonth(date);
|
||||
int year = GWEN_Date_GetYear(date);
|
||||
/* Some banks use nominal 30-day months and set the value date as
|
||||
* the day after the posted date. In February this can appear to
|
||||
* be an invalid date because February has fewer than 30 days. If
|
||||
* that's the case then back up a day to get a real date for
|
||||
* posting.
|
||||
*/
|
||||
if (month == 2 && day <= 30 && day > is_leap_year(year) ? 29 : 28)
|
||||
--day;
|
||||
return gnc_dmy2time64_neutral(day, month, year);
|
||||
#else
|
||||
int month, day, year;
|
||||
GWEN_Time_GetBrokenDownDate(date, &day, &month, &year);
|
||||
|
||||
Reference in New Issue
Block a user