mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
more merges from 1.0 branch
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@423 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
eeed9a13d9
commit
75c1407b95
10
src/date.c
10
src/date.c
@ -43,6 +43,8 @@ static int validateDate( Date *date );
|
|||||||
static
|
static
|
||||||
char days[12] = { 31,28,31,30,31,30,31,31,30,31,30,31 };
|
char days[12] = { 31,28,31,30,31,30,31,31,30,31,30,31 };
|
||||||
|
|
||||||
|
static int been_here = 0;
|
||||||
|
|
||||||
/********************************************************************\
|
/********************************************************************\
|
||||||
* adjustDay *
|
* adjustDay *
|
||||||
* adds adj to the current day of the month... the resulting day *
|
* adds adj to the current day of the month... the resulting day *
|
||||||
@ -91,6 +93,10 @@ validateDate( Date *date )
|
|||||||
{
|
{
|
||||||
int valid = True;
|
int valid = True;
|
||||||
|
|
||||||
|
/* the "been here" flag prevents infinite recursion */
|
||||||
|
if (1 == been_here) return valid;
|
||||||
|
been_here = 1;
|
||||||
|
|
||||||
/* adjust days in february for leap year */
|
/* adjust days in february for leap year */
|
||||||
if ( ( ( date->year % 4 == 0 ) && ( date->year % 100 != 0 ) )
|
if ( ( ( date->year % 4 == 0 ) && ( date->year % 100 != 0 ) )
|
||||||
|| ( date->year % 400 == 0 ) )
|
|| ( date->year % 400 == 0 ) )
|
||||||
@ -125,6 +131,10 @@ validateDate( Date *date )
|
|||||||
date->year--;
|
date->year--;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* try again, in case a year change messed up leap year calcs. */
|
||||||
|
validateDate (date);
|
||||||
|
been_here = 0;
|
||||||
|
|
||||||
return valid;
|
return valid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user