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:
@@ -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
|
||||
|
||||
|
Reference in New Issue
Block a user