Enhancement - Duration

- Relocated util/formatSeconds and util/formatSecondsCompact into
  Duration object.
- Relocated unit tests.
- Upgraded Duration object to use seconds, not days.
- Enhanced Duration so that it can now parse '4 mins' etc.
This commit is contained in:
Paul Beckingham 2010-06-27 00:57:52 -04:00
parent 1f8f4c631d
commit 9477660e02
10 changed files with 600 additions and 584 deletions

View file

@ -323,11 +323,11 @@ Date getNextRecurrence (Date& current, std::string& period)
}
// If the period is an 'easy' one, add it to current, and we're done.
int days = 0;
try { Duration du (period); days = du; }
catch (...) { days = 0; }
int secs = 0;
try { Duration du (period); secs = du; }
catch (...) { secs = 0; }
return current + (days * 86400);
return current + secs;
}
////////////////////////////////////////////////////////////////////////////////