LocalTimeRK
|
A single item in a schedule, such as minute of hour, hour of day, or a specific time. More...
#include <LocalTimeRK.h>
Public Types | |
enum class | ScheduleItemType : int { NONE = 0 , MINUTE_OF_HOUR , HOUR_OF_DAY , DAY_OF_WEEK_OF_MONTH , DAY_OF_MONTH , TIME } |
Type of schedule item this is. More... | |
Public Member Functions | |
LocalTimeScheduleItem () | |
Default constructor. Set increment and optionally timeRange to use. | |
bool | isValid () const |
Returns true ScheduleItemType is not NONE. More... | |
time_t | getTimeSpan (const LocalTimeConvert &conv) const |
Get number of seconds in the time range at a given time. More... | |
bool | getNextScheduledTime (LocalTimeConvert &conv) const |
Update the conv object to point at the next schedule item. More... | |
LocalTimeYMD | getExpirationDate () const |
For restricted time ranges, get the last date (YMD) that this time range could be valid. More... | |
void | fromJson (JSONValue jsonObj) |
Creates an object from JSON. More... | |
Data Fields | |
LocalTimeRange | timeRange |
Range of local time, inclusive. | |
int | increment = 0 |
Increment value, or sometimes ordinal value. | |
int | dayOfWeek = 0 |
Used for DAY_OF_WEEK_OF_MONTH only. | |
int | flags = 0 |
Optional scheduling flags. | |
String | name |
Optional name. | |
ScheduleItemType | scheduleItemType = ScheduleItemType::NONE |
The type of schedule item. | |
A single item in a schedule, such as minute of hour, hour of day, or a specific time.
|
strong |
void LocalTimeScheduleItem::fromJson | ( | JSONValue | jsonObj | ) |
Creates an object from JSON.
jsonObj | The schedule. This should be the object containing the values, not the array. |
Keys:
|
inline |
For restricted time ranges, get the last date (YMD) that this time range could be valid.
This will return the empty date for most cases. A valid value is returned if the LocalTimeRestrictedDate is used, and an only on date is set. In this case, there's as point in time where this range will never be true. This is used to optimize scheduling.
bool LocalTimeScheduleItem::getNextScheduledTime | ( | LocalTimeConvert & | conv | ) | const |
Update the conv object to point at the next schedule item.
conv | LocalTimeConvert object, may be modified |
This method finds the next scheduled time of this item, if it's in the near future. The LocalTime::instance().getScheduleLookaheadDays() setting determines how far in the future to check; the default is 100 days. The way schedules work each day needs to be checked to make sure all of the constraints are met, so long look-aheads are computationally intensive. This is not normally an issue, because the idea is that you'll wake from sleep or check the schedule at least every few days, at which point the new schedule may be available.
|
inline |
Get number of seconds in the time range at a given time.
conv | The timezone and date information for time span calculation |
The conv object is necessary because getTimeSpan takes into account daylight saving transitions. When springing forward to daylight saving, from 01:15:00 to 03:15:00 is only one hour because of the DST transition.
|
inline |
Returns true ScheduleItemType is not NONE.
This is used to check if an object was constructed by the default constructor and never set.