Interval in time specified as start and end timestamps.
More...
#include <kanzi/core/time/time_interval.hpp>
|
chrono::milliseconds | clampToInterval (chrono::milliseconds time) const |
| Clamps time to interval.
|
|
bool | contains (chrono::milliseconds time) const |
| Determines whether the interval contains specified timestamp.
|
|
optional< chrono::milliseconds > | getDuration () const |
| Gets the duration of interval.
|
|
optional< chrono::milliseconds > | getEnd () const |
| Gets end timestamp.
|
|
optional< chrono::milliseconds > | getStart () const |
| Gets start timestamp.
|
|
bool | isEnd (chrono::milliseconds time) const |
| Determines whether specified timestamp equals to end of interval.
|
|
bool | isStart (chrono::milliseconds time) const |
| Determines whether specified timestamp equals to start of interval.
|
|
| TimeInterval () |
| Default constructor.
|
|
| TimeInterval (optional< chrono::milliseconds > start, optional< chrono::milliseconds > end) |
| Constructor.
|
|
Interval in time specified as start and end timestamps.
◆ TimeInterval() [1/2]
kanzi::TimeInterval::TimeInterval |
( |
| ) |
|
|
explicit |
Default constructor.
Initializes start of interval to negative infinity and end of interval to negative infinity.
◆ TimeInterval() [2/2]
kanzi::TimeInterval::TimeInterval |
( |
optional< chrono::milliseconds > | start, |
|
|
optional< chrono::milliseconds > | end ) |
|
explicit |
Constructor.
If start and end are both defined and start in bigger than end, interval will switch start and end.
- Parameters
-
start | Start timestamp of interval. Empty optional specifies negative infinity. |
end | End timestamp of interval. Empty optional specifies positive infinity. |
◆ getStart()
optional< chrono::milliseconds > kanzi::TimeInterval::getStart |
( |
| ) |
const |
Gets start timestamp.
Empty optional specifies negative infinity.
- Returns
- start timestamp.
◆ getEnd()
optional< chrono::milliseconds > kanzi::TimeInterval::getEnd |
( |
| ) |
const |
Gets end timestamp.
Empty optional specifies positive infinity.
- Returns
- end timestamp.
◆ getDuration()
optional< chrono::milliseconds > kanzi::TimeInterval::getDuration |
( |
| ) |
const |
Gets the duration of interval.
Empty optional specifies infinite duration.
- Returns
- end timestamp.
◆ contains()
bool kanzi::TimeInterval::contains |
( |
chrono::milliseconds | time | ) |
const |
Determines whether the interval contains specified timestamp.
- Parameters
-
- Returns
- true if the timestamp is within interval, false otherwise.
◆ isStart()
bool kanzi::TimeInterval::isStart |
( |
chrono::milliseconds | time | ) |
const |
Determines whether specified timestamp equals to start of interval.
- Parameters
-
- Returns
- true if the timestamp equals to start of interval.
◆ isEnd()
bool kanzi::TimeInterval::isEnd |
( |
chrono::milliseconds | time | ) |
const |
Determines whether specified timestamp equals to end of interval.
- Parameters
-
- Returns
- true if the timestamp equals to end of interval.
◆ clampToInterval()
chrono::milliseconds kanzi::TimeInterval::clampToInterval |
( |
chrono::milliseconds | time | ) |
const |
Clamps time to interval.
- Parameters
-
- Returns
- clamped timestamp.
◆ createFromStartTimeAndDuration()
static TimeInterval kanzi::TimeInterval::createFromStartTimeAndDuration |
( |
chrono::milliseconds | start, |
|
|
optional< chrono::milliseconds > | duration ) |
|
static |
Creates interval from start time and duration.
- Parameters
-
start | Start timestamp of interval. |
duration | Duration of interval. Empty optional specifies infinite duration. |
The documentation for this struct was generated from the following file: