mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-20 02:55:50 +00:00
Add more methods to RelativeTime
This commit is contained in:
@@ -60,6 +60,12 @@ public:
|
|||||||
/** Destructor. */
|
/** Destructor. */
|
||||||
~RelativeTime() noexcept;
|
~RelativeTime() noexcept;
|
||||||
|
|
||||||
|
bool isZero() const
|
||||||
|
{ return numSeconds == 0; }
|
||||||
|
|
||||||
|
bool isNotZero() const
|
||||||
|
{ return numSeconds != 0; }
|
||||||
|
|
||||||
/** Returns the amount of time since the process was started. */
|
/** Returns the amount of time since the process was started. */
|
||||||
static RelativeTime fromStartup ();
|
static RelativeTime fromStartup ();
|
||||||
|
|
||||||
@@ -148,10 +154,12 @@ public:
|
|||||||
String getDescription (const String& returnValueForZeroTime = "0") const;
|
String getDescription (const String& returnValueForZeroTime = "0") const;
|
||||||
std::string to_string () const;
|
std::string to_string () const;
|
||||||
|
|
||||||
RelativeTime operator+ (double seconds) const noexcept
|
template <typename Number>
|
||||||
|
RelativeTime operator+ (Number seconds) const noexcept
|
||||||
{ return RelativeTime (numSeconds + seconds); }
|
{ return RelativeTime (numSeconds + seconds); }
|
||||||
|
|
||||||
RelativeTime operator- (double seconds) const noexcept
|
template <typename Number>
|
||||||
|
RelativeTime operator- (Number seconds) const noexcept
|
||||||
{ return RelativeTime (numSeconds - seconds); }
|
{ return RelativeTime (numSeconds - seconds); }
|
||||||
|
|
||||||
/** Adds another RelativeTime to this one. */
|
/** Adds another RelativeTime to this one. */
|
||||||
|
|||||||
Reference in New Issue
Block a user