Interval in time specified as start and end timestamps.
More...
#include <kanzi/core/time/time_interval.hpp>
|
| TimeInterval () |
| Default constructor. More...
|
|
| TimeInterval (optional< chrono::milliseconds > start, optional< chrono::milliseconds > end) |
| Constructor. More...
|
|
optional< chrono::milliseconds > | getStart () const |
| Gets start timestamp. More...
|
|
optional< chrono::milliseconds > | getEnd () const |
| Gets end timestamp. More...
|
|
optional< chrono::milliseconds > | getDuration () const |
| Gets the duration of interval. More...
|
|
bool | contains (chrono::milliseconds time) const |
| Determines whether the interval contains specified timestamp. More...
|
|
bool | isStart (chrono::milliseconds time) const |
| Determines whether specified timestamp equals to start of interval. More...
|
|
bool | isEnd (chrono::milliseconds time) const |
| Determines whether specified timestamp equals to end of interval. More...
|
|
chrono::milliseconds | clampToInterval (chrono::milliseconds time) const |
| Clamps time to interval. More...
|
|
Interval in time specified as start and end timestamps.
kanzi::TimeInterval::TimeInterval |
( |
| ) |
|
|
explicit |
Default constructor.
Initializes start of interval to negative infinity and end of interval to negative infinity.
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. |
optional<chrono::milliseconds> kanzi::TimeInterval::getStart |
( |
| ) |
const |
Gets start timestamp.
Empty optional specifies negative infinity.
- Returns
- start timestamp.
optional<chrono::milliseconds> kanzi::TimeInterval::getEnd |
( |
| ) |
const |
Gets end timestamp.
Empty optional specifies positive infinity.
- Returns
- end timestamp.
optional<chrono::milliseconds> kanzi::TimeInterval::getDuration |
( |
| ) |
const |
Gets the duration of interval.
Empty optional specifies infinite duration.
- Returns
- end timestamp.
bool kanzi::TimeInterval::contains |
( |
chrono::milliseconds |
time | ) |
const |
Determines whether the interval contains specified timestamp.
time Timestamp to test.
- Returns
- true if the timestamp is within interval, false otherwise.
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.
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.
chrono::milliseconds kanzi::TimeInterval::clampToInterval |
( |
chrono::milliseconds |
time | ) |
const |
Clamps time to interval.
- Parameters
-
- Returns
- clamped timestamp.
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: