Add operators to Timestamp for Timespan.

Timestamp  operator +  (const Timespan& span) const;
Timestamp  operator -  (const Timespan& span) const;
Timestamp& operator += (const Timespan& span);
Timestamp& operator -= (const Timespan& span);
This commit is contained in:
Mike Naquin
2013-05-06 15:29:52 -05:00
parent e06fec0e24
commit 44ba01648d
2 changed files with 30 additions and 0 deletions

View File

@@ -35,6 +35,7 @@
#include "Poco/Timestamp.h"
#include "Poco/Timespan.h"
#include "Poco/Exception.h"
#include <algorithm>
#if defined(POCO_OS_FAMILY_UNIX)
@@ -256,6 +257,30 @@ void Timestamp::update()
}
Timestamp Timestamp::operator + (const Timespan& span) const
{
return *this + span.totalMicroseconds();
}
Timestamp Timestamp::operator - (const Timespan& span) const
{
return *this - span.totalMicroseconds();
}
Timestamp& Timestamp::operator += (const Timespan& span)
{
return *this += span.totalMicroseconds();
}
Timestamp& Timestamp::operator -= (const Timespan& span)
{
return *this -= span.totalMicroseconds();
}
#if defined(_WIN32)