added: some methods for parsing from a string

git-svn-id: svn://ttmath.org/publicrep/pikotools/trunk@412 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
2012-05-22 23:47:41 +00:00
parent e25bc826e7
commit 0ffb2b155f
2 changed files with 563 additions and 23 deletions

View File

@@ -255,6 +255,35 @@ void Date::AssertCorrectDate()
}
bool Date::IsCorrectDate()
{
// 10000 is only a 'cosmetic' limit
// we can make calculations with greater values
if( year < 1970 || year > 10000 )
return false;
if( month < 1 || month > 12 )
return false;
if( day < 1 || day > MonthLen(year, month) )
return false;
if( hour < 0 || hour > 23 )
return false;
if( min < 0 || min > 59 )
return false;
if( sec < 0 || sec > 59 )
return false;
return true;
}
int Date::MonthLen(int y, int m)
{
@@ -381,5 +410,7 @@ return (int)((d+3) % 7);
} // namespace