clock

German local time (CET/CEST) from UTC, without a timezone database.

EU rule: summer time runs from the last Sunday in March, 01:00 UTC, to the last Sunday in October, 01:00 UTC. Functions take time.gmtime() tuples: (year, month, mday, hour, minute, second, weekday [Monday = 0], yearday).

Attributes

Functions

is_summer_time(utc)

Whether German summer time (CEST) applies at a UTC time.

local_minutes(utc)

Minutes since local midnight, or None if the clock is not set.

local_hhmm(utc)

Local wall-clock time as "HH:MM", or None if the clock is not set.

parse_iso(text)

Parse an ISO 8601 time into a UTC time tuple.

local_date_hhmm(utc)

Local date and time as "26.09. 18:00", or None for an unset time.

Module Contents

clock.MIN_VALID_YEAR = 2024
clock.SECONDS_PER_DAY = 86400
clock.is_summer_time(utc)

Whether German summer time (CEST) applies at a UTC time.

Parameters:

utc – A time.gmtime() tuple.

Returns:

00 UTC.

Return type:

True between the last Sundays of March and October, 01

clock.local_minutes(utc)

Minutes since local midnight, or None if the clock is not set.

clock.local_hhmm(utc)

Local wall-clock time as “HH:MM”, or None if the clock is not set.

clock.parse_iso(text)

Parse an ISO 8601 time into a UTC time tuple.

Accepts times like “2026-09-26T18:00:00+02:00”, “…Z” or without zone (taken as UTC), as Home Assistant’s attributes contain them.

Parameters:

text – The time as text.

Returns:

A time.gmtime()-like tuple in UTC, or None if it cannot be read.

clock.local_date_hhmm(utc)

Local date and time as “26.09. 18:00”, or None for an unset time.