Code Cleanup

- Remove the code related to the format "day of year" (number of day starting
  from the January 1) as mktime does not allow to specify it with the field
  tm_yday.
- Cleaner check of the date (everything is done by Date::valid).
- Correct hour, minute and second is also checked.
This commit is contained in:
Louis-Claude Canon 2012-07-30 16:31:21 +02:00 committed by Paul Beckingham
parent b5cd5ea188
commit 384be4b249
4 changed files with 20 additions and 22 deletions

View file

@ -35,7 +35,7 @@ Context context;
////////////////////////////////////////////////////////////////////////////////
int main (int argc, char** argv)
{
UnitTest t (177);
UnitTest t (179);
try
{
@ -86,6 +86,9 @@ int main (int argc, char** argv)
t.ok (Date::valid ("2/29/2008"), "valid: 2/29/2008");
t.notok (Date::valid ("2/29/2007"), "invalid: 2/29/2007");
t.ok (Date::valid (366, 2008), "valid: 366 days in 2008");
t.notok (Date::valid (366, 2007), "invalid: 366 days in 2007");
// Time validity.
t.ok (Date::valid (2, 28, 2010, 0, 0, 0), "valid 2/28/2010 0:00:00");
t.ok (Date::valid (2, 28, 2010, 23, 59, 59), "valid 2/28/2010 23:59:59");