ESPHome 2026.3.0-dev
Loading...
Searching...
No Matches
posix_tz.h File Reference

Go to the source code of this file.

Data Structures

struct  esphome::time::DSTRule
 Rule for DST transition (packed for 32-bit: 12 bytes) More...
 
struct  esphome::time::ParsedTimezone
 Parsed POSIX timezone information (packed for 32-bit: 32 bytes) More...
 

Namespaces

namespace  esphome
 Providing packet encoding functions for exchanging data with a remote host.
 
namespace  esphome::time
 
namespace  esphome::time::internal
 

Enumerations

enum class  esphome::time::DSTRuleType : uint8_t { esphome::time::NONE = 0 , esphome::time::MONTH_WEEK_DAY , esphome::time::JULIAN_NO_LEAP , esphome::time::DAY_OF_YEAR }
 Type of DST transition rule. More...
 

Functions

bool esphome::time::parse_posix_tz (const char *tz_string, ParsedTimezone &result)
 Parse a POSIX TZ string into a ParsedTimezone struct.
 
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.
 
void esphome::time::set_global_tz (const ParsedTimezone &tz)
 Set the global timezone used by epoch_to_local_tm() when called without a timezone.
 
const ParsedTimezoneesphome::time::get_global_tz ()
 Get the global timezone.
 
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.
 
bool esphome::time::internal::skip_tz_name (const char *&p)
 Skip a timezone name (letters or <...> quoted format)
 
int32_t esphome::time::internal::parse_offset (const char *&p)
 Parse an offset in format [-]hh[:mm[:ss]].
 
bool esphome::time::internal::parse_dst_rule (const char *&p, DSTRule &rule)
 Parse a DST rule in format Mm.w.d[/time], Jn[/time], or n[/time].
 
void esphome::time::internal::julian_to_month_day (int julian_day, int &month, int &day)
 Convert Julian day (J format, 1-365 not counting Feb 29) to month/day.
 
void esphome::time::internal::day_of_year_to_month_day (int day_of_year, int year, int &month, int &day)
 Convert day of year (plain format, 0-365 counting Feb 29) to month/day.
 
int esphome::time::internal::day_of_week (int year, int month, int day)
 Calculate day of week for any date (0 = Sunday) Uses a simplified algorithm that works for years 1970-2099.
 
int esphome::time::internal::days_in_month (int year, int month)
 Get the number of days in a month.
 
bool esphome::time::internal::is_leap_year (int year)
 Check if a year is a leap year.
 
void esphome::time::internal::epoch_to_tm_utc (time_t epoch, struct tm *out_tm)
 Convert epoch to year/month/day/hour/min/sec (UTC)
 
time_t esphome::time::internal::calculate_dst_transition (int year, const DSTRule &rule, int32_t base_offset_seconds)
 Calculate the epoch timestamp for a DST transition in a given year.