|
ESPHome 2026.3.0-dev
|
Namespaces | |
| namespace | internal |
Data Structures | |
| class | CronTrigger |
| struct | DSTRule |
| Rule for DST transition (packed for 32-bit: 12 bytes) More... | |
| struct | ParsedTimezone |
| Parsed POSIX timezone information (packed for 32-bit: 32 bytes) More... | |
| class | RealTimeClock |
| The RealTimeClock class exposes common timekeeping functions via the device's local real-time clock. More... | |
| class | SyncTrigger |
| class | TimeHasTimeCondition |
Enumerations | |
| enum class | DSTRuleType : uint8_t { NONE = 0 , MONTH_WEEK_DAY , JULIAN_NO_LEAP , DAY_OF_YEAR } |
| Type of DST transition rule. More... | |
Functions | |
| void | set_global_tz (const ParsedTimezone &tz) |
| Set the global timezone used by epoch_to_local_tm() when called without a timezone. | |
| const ParsedTimezone & | get_global_tz () |
| Get the global timezone. | |
| if (dst_start< dst_end) | |
| bool | parse_posix_tz (const char *tz_string, ParsedTimezone &result) |
| Parse a POSIX TZ string into a ParsedTimezone struct. | |
| bool | epoch_to_local_tm (time_t utc_epoch, const ParsedTimezone &tz, struct tm *out_tm) |
| Convert a UTC epoch to local time using the parsed timezone. | |
| bool | is_in_dst (time_t utc_epoch, const ParsedTimezone &tz) |
| Check if a given UTC epoch falls within DST for the parsed timezone. | |
Variables | |
| bool const ParsedTimezone & | tz |
| time_t | dst_start = internal::calculate_dst_transition(year, tz.dst_start, tz.std_offset_seconds) |
| time_t | dst_end = internal::calculate_dst_transition(year, tz.dst_end, tz.dst_offset_seconds) |
| else | |
| ESPTime | __attribute__ ((noinline)) RealTimeClock |
|
strong |
Type of DST transition rule.
Definition at line 11 of file posix_tz.h.
| bool esphome::time::epoch_to_local_tm | ( | time_t | utc_epoch, |
| const ParsedTimezone & | tz, | ||
| struct tm * | out_tm ) |
Convert a UTC epoch to local time using the parsed timezone.
This replaces libc's localtime() to avoid scanf dependency.
| utc_epoch | Unix timestamp in UTC | |
| tz | The parsed timezone | |
| [out] | out_tm | Output tm struct with local time |
Definition at line 445 of file posix_tz.cpp.
| const ParsedTimezone & esphome::time::get_global_tz | ( | ) |
Get the global timezone.
Definition at line 16 of file posix_tz.cpp.
| esphome::time::if | ( | ) |
Definition at line 359 of file posix_tz.cpp.
| bool esphome::time::is_in_dst | ( | time_t | utc_epoch, |
| const ParsedTimezone & | tz ) |
Check if a given UTC epoch falls within DST for the parsed timezone.
| utc_epoch | Unix timestamp in UTC |
| tz | The parsed timezone |
| bool esphome::time::parse_posix_tz | ( | const char * | tz_string, |
| ParsedTimezone & | result ) |
Parse a POSIX TZ string into a ParsedTimezone struct.
Supports formats like:
| tz_string | The POSIX TZ string to parse |
| result | Output: the parsed timezone data |
Definition at line 374 of file posix_tz.cpp.
| void esphome::time::set_global_tz | ( | const ParsedTimezone & | tz | ) |
Set the global timezone used by epoch_to_local_tm() when called without a timezone.
This is called by RealTimeClock::apply_timezone_() to enable ESPTime::from_epoch_local() to work without libc's localtime().
Definition at line 14 of file posix_tz.cpp.
| bool esphome::time::__attribute__ | ( | (noinline) | ) |
Definition at line 26 of file real_time_clock.cpp.
| time_t esphome::time::dst_end = internal::calculate_dst_transition(year, tz.dst_end, tz.dst_offset_seconds) |
Definition at line 357 of file posix_tz.cpp.
| time_t esphome::time::dst_start = internal::calculate_dst_transition(year, tz.dst_start, tz.std_offset_seconds) |
Definition at line 355 of file posix_tz.cpp.
| esphome::time::else |
Definition at line 362 of file posix_tz.cpp.
| bool const ParsedTimezone& esphome::time::tz |
Definition at line 346 of file posix_tz.cpp.