LocalTimeRK
|
Handles the time change part of the Posix timezone string like "M3.2.0/2:00:00". More...
#include <LocalTimeRK.h>
Public Member Functions | |
LocalTimeChange () | |
Default contructor. | |
virtual | ~LocalTimeChange () |
Destructor. | |
LocalTimeChange (const char *str) | |
Constructs a time change object with a string format (calls parse()) More... | |
void | clear () |
Clears all values. | |
void | parse (const char *str) |
Parses a time change string. More... | |
String | toString () const |
Turns the parsed data into a normalized string like "M3.2.0/2:00:00". | |
time_t | calculate (struct tm *pTimeInfo, LocalTimeHMS tzAdjust) const |
Calculate the time change in a given year. More... | |
Data Fields | |
int8_t | month = 0 |
1-12, 1=January | |
int8_t | week = 0 |
1-5, 1=first | |
int8_t | dayOfWeek = 0 |
0-6, 0=Sunday, 1=Monday, ... | |
int8_t | valid = 0 |
true = valid | |
LocalTimeHMS | hms |
Local time when timezone change occurs. | |
Handles the time change part of the Posix timezone string like "M3.2.0/2:00:00".
Other formats with shortened time of day are also allowed like "M3.2.0/2" or even "M3.2.0" (midnight) are also allowed. Since the hour is local time, it can also be negative "M3.2.0/-1".
LocalTimeChange::LocalTimeChange | ( | const char * | str | ) |
Constructs a time change object with a string format (calls parse())
str | the time change string to parse |
The time change string is part of the POSIX timezone specification and looks something like "M3.2.0/2:00:00".
time_t LocalTimeChange::calculate | ( | struct tm * | pTimeInfo, |
LocalTimeHMS | tzAdjust | ||
) | const |
Calculate the time change in a given year.
On input, pTimeInfo must have a valid tm_year (121 = 2021) set.
On output, all struct tm values are set appropriately with UTC values of when the time change occurs.
void LocalTimeChange::parse | ( | const char * | str | ) |
Parses a time change string.
str | the time change string to parse |
The time change string is part of the POSIX timezone specification and looks something like "M3.2.0/2:00:00".
Setting the week to 5 essentially means the last week of the month. If the month does not have a fifth week for that day of the week, then the fourth is used instead.