BeeeOn Gateway  v2020.3.1-2-g6f737dc
Platform to interconnect the IoT world
Public Member Functions | Static Public Member Functions
BeeeOn::TimeInterval Class Reference

#include <TimeInterval.h>

Public Member Functions

 TimeInterval (const Poco::Timestamp &start, const Poco::Timestamp &end)
 
bool isEmpty () const
 
bool isBefore (const Poco::Timestamp &at) const
 
Poco::Timestamp start () const
 
Poco::Timestamp end () const
 
const Poco::Timestamp & start ()
 
const Poco::Timestamp & end ()
 

Static Public Member Functions

static TimeInterval past (const Poco::Timespan &range, const Poco::Timestamp &end=Poco::Timestamp())
 

Detailed Description

Interval between two timestamps. The start must always be less or equal to end. The duration of the interval is defined as:

m_end - m_start

The m_end is not part of the interval.

Member Function Documentation

bool TimeInterval::isBefore ( const Poco::Timestamp &  at) const

The time interval both starts and ends before the given timestampt at.

bool TimeInterval::isEmpty ( ) const

The time interval is empty (start == end).

TimeInterval TimeInterval::past ( const Poco::Timespan &  range,
const Poco::Timestamp &  end = Poco::Timestamp() 
)
static

Create interval for past range from the given end reference timepoint. Examples:

TimeInterval last5Min = TimeInterval::past(5 * Timespan::MINUTES);
TimeInterval lastHourOfYear = TimeInterval::past(
                1 * TimeInterval::HOURS,
                Timestamp::fromEpochTime(1483225200));

The last5Min is interval lasting 5 minutes just before now.
The lastHourOfYear is an interval representing the last hour of year 2016.

The documentation for this class was generated from the following files: