mirror of
https://github.com/pocoproject/poco.git
synced 2025-11-25 06:36:37 +01:00
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:
@@ -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)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user