mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
Enhancement - Date::operator-
- Implemented Date::operator-, to allow subtractions of Durations.
This commit is contained in:
parent
031c4c484d
commit
cb4fe4fffb
3 changed files with 10 additions and 2 deletions
|
@ -24,7 +24,6 @@
|
|||
// USA
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
#include <sstream>
|
||||
#include <time.h>
|
||||
|
@ -808,6 +807,12 @@ bool Date::sameYear (const Date& rhs)
|
|||
return false;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
Date Date::operator- (const int delta)
|
||||
{
|
||||
return Date (mT - delta);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
Date Date::operator+ (const int delta)
|
||||
{
|
||||
|
|
|
@ -85,6 +85,7 @@ public:
|
|||
bool sameYear (const Date&);
|
||||
|
||||
Date operator+ (const int);
|
||||
Date operator- (const int);
|
||||
Date& operator+= (const int);
|
||||
Date& operator-= (const int);
|
||||
|
||||
|
|
|
@ -314,6 +314,8 @@ int main (int argc, char** argv)
|
|||
|
||||
Date r16 ("6/7/2010 00:59:59", "m/d/Y H:N:S");
|
||||
t.notok (r14.sameHour (r16), "two dates not within the same hour");
|
||||
|
||||
// TODO Date::operator-
|
||||
}
|
||||
|
||||
catch (std::string& e)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue