A RepetitiveInterval is an advanced interval which can repeat and can be used to find a simple Interval that a time point falls in.
More...
#include <repetitive-interval.hpp>
|
| enum | RepeatUnit { NONE = 0,
DAY = 1,
MONTH = 2,
YEAR = 3
} |
| |
A RepetitiveInterval is an advanced interval which can repeat and can be used to find a simple Interval that a time point falls in.
- Note
- This class is an experimental feature. The API may change.
| ndn::RepetitiveInterval::RepetitiveInterval |
( |
MillisecondsSince1970 |
startDate, |
|
|
MillisecondsSince1970 |
endDate, |
|
|
int |
intervalStartHour, |
|
|
int |
intervalEndHour, |
|
|
int |
nRepeats = 0, |
|
|
RepeatUnit |
repeatUnit = RepeatUnit::NONE |
|
) |
| |
Create a RepetitiveInterval with the given values.
startDate must be earlier than or same as endDate. intervalStartHour must be less than intervalEndHour.
- Parameters
-
| startDate | The start date as milliseconds since Jan 1, 1970 UTC. |
| endDate | The end date as milliseconds since Jan 1, 1970 UTC. |
| intervalStartHour | The start hour in the day, from 0 to 23. |
| intervalEndHour | The end hour in the day from 1 to 24. |
| nRepeats | (optional) Repeat the interval nRepeats repetitions, every unit, until endDate. If ommitted, use 0. |
| repeatUnit | (optional) The unit of the repetition. If this is NONE or omitted, then startDate must equal endDate. If omitted, use NONE. |
- Exceptions
-
| runtime_error | if the above conditions are not met. |
Compare this to the other RepetitiveInterval.
- Parameters
-
- Returns
- -1 if this is less than the other, 1 if greater and 0 if equal.
Get the end date.
- Returns
- The end date as milliseconds since Jan 1, 1970 UTC.
Get an interval that covers the time point.
If there is no interval covering the time point, this returns false for isPositive and returns a negative interval.
- Parameters
-
| timePoint | The time point as milliseconds since Jan 1, 1970 UTC. |
- Returns
- An object with fields (isPositive, interval) where isPositive is true if the returned interval is positive or false if negative, and interval is the Interval covering the time point or a negative interval if not found.
| int ndn::RepetitiveInterval::getIntervalEndHour |
( |
| ) |
const |
|
inline |
Get the interval end hour.
- Returns
- The interval end hour.
| int ndn::RepetitiveInterval::getIntervalStartHour |
( |
| ) |
const |
|
inline |
Get the interval start hour.
- Returns
- The interval start hour.
| int ndn::RepetitiveInterval::getNRepeats |
( |
| ) |
const |
|
inline |
Get the number of repeats.
- Returns
- The number of repeats.
| RepeatUnit ndn::RepetitiveInterval::getRepeatUnit |
( |
| ) |
const |
|
inline |
Get the repeat unit.
- Returns
- The repeat unit.
Get the start date.
- Returns
- The start date as milliseconds since Jan 1, 1970 UTC.
The documentation for this class was generated from the following files: