ISO8601d: Added ::leapYear and tests

This commit is contained in:
Paul Beckingham 2015-09-26 13:47:27 -04:00
parent f615db8a4c
commit 6f5d07dcd4
3 changed files with 18 additions and 1 deletions

View file

@ -798,6 +798,14 @@ bool ISO8601p::parse (const std::string& input, std::string::size_type& start)
return false;
}
////////////////////////////////////////////////////////////////////////////////
// Static
bool ISO8601d::leapYear (int year)
{
return ((! (year % 4)) && (year % 100)) ||
! (year % 400);
}
////////////////////////////////////////////////////////////////////////////////
// Static
int ISO8601d::dayOfWeek (const std::string& input)
@ -817,6 +825,7 @@ int ISO8601d::dayOfWeek (const std::string& input)
}
////////////////////////////////////////////////////////////////////////////////
// Static
int ISO8601d::length (const std::string& format)
{
int len = 0;