AceTime 3.0.0 Date and time classes for Arduino that support timezones from the TZ Database.

ZonedExtra.cpp
1 #include "ZonedExtra.h"
2 #include "TimeZone.h"
3
4 namespace ace_time {
5
6 ZonedExtra ZonedExtra::forComponents(
7 int16_t year, uint8_t month, uint8_t day,
8 uint8_t hour, uint8_t minute, uint8_t second,
9 const TimeZone& tz, uint8_t fold) {
10 auto ldt = LocalDateTime::forComponents(
11 year, month, day, hour, minute, second, fold);
12 return forLocalDateTime(ldt, tz);
13 }
14
15 // These are defined in the .cpp file to break cyclic dependency.
16 ZonedExtra ZonedExtra::forEpochSeconds(
17 acetime_t epochSeconds,
18 const TimeZone& tz) {
19 return tz.getZonedExtra(epochSeconds);
20 }
21
22 // These are defined in the .cpp file to break cyclic dependency.
23 ZonedExtra ZonedExtra::forLocalDateTime(
24 const LocalDateTime& ldt,
25 const TimeZone& tz) {
26 return tz.getZonedExtra(ldt);
27 }
28
29 }
ace_time::LocalDateTime
Class that holds the date-time as the components (year, month, day, hour, minute, second) without reg...
Definition: LocalDateTime.h:30
ace_time::LocalDateTime::forComponents
static LocalDateTime forComponents(int16_t year, uint8_t month, uint8_t day, uint8_t hour, uint8_t minute, uint8_t second, uint8_t fold=0)
Factory method using separated date and time components.
Definition: LocalDateTime.h:44
ace_time::TimeZone
Class that describes a time zone.
Definition: TimeZone.h:86
ace_time::TimeZone::getZonedExtra
ZonedExtra getZonedExtra(const LocalDateTime &ldt) const
Return the ZonedExtra information at epochSeconds.
Definition: TimeZone.h:304
ace_time::ZonedExtra
Definition: ZonedExtra.h:19
ace_time::ZonedExtra::forLocalDateTime
static ZonedExtra forLocalDateTime(const LocalDateTime &ldt, const TimeZone &tz)
Return an instance for the given LocalDateTime and TimeZone.
Definition: ZonedExtra.cpp:23
ace_time::ZonedExtra::forComponents
static ZonedExtra forComponents(int16_t year, uint8_t month, uint8_t day, uint8_t hour, uint8_t minute, uint8_t second, const TimeZone &tz, uint8_t fold=0)
Return an instance for the given LocalDateTime and TimeZone.
Definition: ZonedExtra.cpp:6
ace_time::ZonedExtra::forEpochSeconds
static ZonedExtra forEpochSeconds(acetime_t epochSeconds, const TimeZone &tz)
Return an instance for the given epochSeconds and TimeZone.
Definition: ZonedExtra.cpp:16
ace_time::acetime_t
int32_t acetime_t
Type for the number of seconds from epoch.
Definition: common.h:24