mirror of
https://github.com/GothenburgBitFactory/timewarrior.git
synced 2025-07-07 20:06:39 +02:00
Range: Added assert that end >= start
This commit is contained in:
parent
998bf1c120
commit
6e85581c8a
1 changed files with 3 additions and 0 deletions
|
@ -27,6 +27,7 @@
|
|||
#include <cmake.h>
|
||||
#include <Range.h>
|
||||
#include <sstream>
|
||||
#include <cassert>
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// A Range consists of a start time and optional end time. A missing end
|
||||
|
@ -285,6 +286,8 @@ std::vector <Range> Range::subtract (const Range& other) const
|
|||
// If the range is open, use 'now' as the end.
|
||||
time_t Range::total () const
|
||||
{
|
||||
assert (end >= start);
|
||||
|
||||
if (is_ended ())
|
||||
return Datetime (end) - Datetime (start);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue