AceTime
0.3
Date and time classes for Arduino that support timezones from the TZ Database, and a system clock that can synchronize from an NTP server or an RTC chip.
|
An implementation of ZoneSpecifier which allows the user to manually adjust the UTC offset and the DST flag. More...
#include <ManualZoneSpecifier.h>
Public Member Functions | |
ManualZoneSpecifier (TimeOffset stdOffset=TimeOffset(), bool isDst=false, const char *stdAbbrev="", const char *dstAbbrev="", TimeOffset deltaOffset=TimeOffset::forHour(1)) | |
Constructor for a time zone with an offset from UTC that does not change with epochSeconds. More... | |
ManualZoneSpecifier (const ManualZoneSpecifier &)=default | |
Default copy constructor. More... | |
ManualZoneSpecifier & | operator= (const ManualZoneSpecifier &)=default |
Default assignment operator. More... | |
TimeOffset | stdOffset () const |
Get the standard UTC offset. More... | |
bool | isDst () const |
Get the current isDst flag. More... | |
const char * | stdAbbrev () const |
Get the standard abbreviation. More... | |
const char * | dstAbbrev () const |
Get the DST abbreviation. More... | |
TimeOffset | deltaOffset () const |
Get the DST delta offset. More... | |
void | stdOffset (TimeOffset offset) |
Set the standard UTC offset. More... | |
void | isDst (bool isDst) |
Set the current isDst flag. More... | |
TimeOffset | getUtcOffset (acetime_t) const override |
Return the total UTC offset at epochSeconds, including DST offset. More... | |
TimeOffset | getDeltaOffset (acetime_t) const override |
Return the DST delta offset at epochSeconds. More... | |
const char * | getAbbrev (acetime_t) const override |
Return the time zone abbreviation at epochSeconds. More... | |
OffsetDateTime | getOffsetDateTime (const LocalDateTime &ldt) const override |
Return the best estimate of the OffsetDateTime at the given LocalDateTime for the timezone of the current ZoneSpecifier. More... | |
void | printTo (Print &printer) const override |
Print the zone specifier in the format of "+/-HH:MM (DST|STD)". More... | |
![]() | |
uint8_t | getType () const |
Return the kTypeXxx of the current instance. More... | |
Additional Inherited Members | |
![]() | |
static const uint8_t | kTypeManual = 1 |
Indicate ManualZoneSpecifier. More... | |
static const uint8_t | kTypeBasic = 2 |
Indicate BasicZoneSpecifier. More... | |
static const uint8_t | kTypeExtended = 3 |
Indicate ExtendedZoneSpecifier. More... | |
![]() | |
ZoneSpecifier (const ZoneSpecifier &)=default | |
ZoneSpecifier & | operator= (const ZoneSpecifier &)=default |
ZoneSpecifier (uint8_t type) | |
Constructor. More... | |
![]() | |
uint8_t | mType |
An implementation of ZoneSpecifier which allows the user to manually adjust the UTC offset and the DST flag.
Unlike BasicZoneSpecifier and ExtendedZoneSpecifier, this class is mutable and copyable to allow the application to detect changes to the timeOffset made by the user.
Definition at line 16 of file ManualZoneSpecifier.h.
|
inlineexplicit |
Constructor for a time zone with an offset from UTC that does not change with epochSeconds.
The internall isDst flag is set to 'false' initially, and can be changed using the isDst(bool) mutator.
Of the 5 parameters in the constructor, only stdOffset and isDst are mutable after construction. The mutators are expected to be called from applications that allow the user to change the UTC offset and isDst flags during runtime. The others are not exposed to be mutable because it seems unrealistic to expect the user to know the standard and DST timezone abbreviations.
stdOffset | base offset of the zone, can be changed using the stdOffset(TimeOffset) mutator (default: 00:00) |
isDst | true if DST shfit is active (default: false) |
stdAbbrev | time zone abbreviation during normal time. Cannot be nullptr. Cannot be changed after construction. (default: "") |
dstAbbrev | time zone abbreviation during DST time. Cannot be nullptr. Cannot be changed after construction. (default: ""). |
deltaOffset | additional UTC offset during DST time. Cannot be changed after construction. (default: +01:00). |
Definition at line 41 of file ManualZoneSpecifier.h.
|
default |
Default copy constructor.
|
inline |
Get the DST delta offset.
Definition at line 73 of file ManualZoneSpecifier.h.
|
inline |
Get the DST abbreviation.
Definition at line 70 of file ManualZoneSpecifier.h.
|
inlineoverridevirtual |
Return the time zone abbreviation at epochSeconds.
This is an experimental method that has not been tested thoroughly. Use with caution. Returns an empty string ("") if an error occurs.
Implements ace_time::ZoneSpecifier.
Definition at line 101 of file ManualZoneSpecifier.h.
|
inlineoverridevirtual |
Return the DST delta offset at epochSeconds.
This is an experimental method that has not been tested thoroughly. Use with caution. Returns TimeOffset::forError() if an error occurs.
Implements ace_time::ZoneSpecifier.
Definition at line 97 of file ManualZoneSpecifier.h.
|
inlineoverridevirtual |
Return the best estimate of the OffsetDateTime at the given LocalDateTime for the timezone of the current ZoneSpecifier.
Returns OffsetDateTime::forError() if an error occurs, for example, if the LocalDateTime is outside of the support date range of the underlying ZoneInfo files.
Implements ace_time::ZoneSpecifier.
Definition at line 105 of file ManualZoneSpecifier.h.
|
inlineoverridevirtual |
Return the total UTC offset at epochSeconds, including DST offset.
Returns TimeOffset::forError() if an error occurs.
Implements ace_time::ZoneSpecifier.
Definition at line 87 of file ManualZoneSpecifier.h.
|
inline |
Get the current isDst flag.
Definition at line 64 of file ManualZoneSpecifier.h.
|
inline |
Set the current isDst flag.
This is expected to be used by applications that allow the user to manually select the DST flag.
Definition at line 85 of file ManualZoneSpecifier.h.
|
default |
Default assignment operator.
|
overridevirtual |
Print the zone specifier in the format of "+/-HH:MM (DST|STD)".
Implements ace_time::ZoneSpecifier.
Definition at line 6 of file ManualZoneSpecifier.cpp.
|
inline |
Get the standard abbreviation.
Definition at line 67 of file ManualZoneSpecifier.h.
|
inline |
Get the standard UTC offset.
Definition at line 61 of file ManualZoneSpecifier.h.
|
inline |
Set the standard UTC offset.
This can be used by applications that allow the user to select a particular UTC offset.
Definition at line 79 of file ManualZoneSpecifier.h.