experimental.rtc

Interface for realtime clock support.

EuroPi can have 0-1 realtime clocks at a time. The implementation is specified via experimental_config. Underlying implementations to handle network and/or I2C hardware is contained with the experimental.clocks namespace.

This module reads the desired implementation from experimental_config and instantiates a clock object that can be used externally.

class experimental.rtc.DateTime(year, month, day, hour, minute, second=None, weekday=None, yearday=None)

Represents a date and time

Parameters
  • year – The current year (e.g. 2025)

  • month – The current month (e.g. Month.JANUARY)

  • day – The current day within the month (e.g. 17)

  • hour – The current hour on a 24-hour clock (0-23)

  • minute – The current minute within the hour (0-59)

  • second – The current second within the minute (0-59, optional)

  • weekday – The current day of the week (e.g. Weekday.MONDAY, optional)

  • yearday – The current day of the year (1-365, 1-366 if leap year, optional)

class experimental.rtc.Month

Container class for month names

class experimental.rtc.RealtimeClock(source)

A continually-running clock that provides the day & date.

This class wraps around an external clock source, e.g. an I2C-compatible RTC module or a network connection to an NTP server

Parameters

source – An ExternalClockSource implementation we read the time from

localnow()

Get the current local time

See experimental_config for instructions on how to configure the local timezone

Returns

a DateTime object representing the current local time

utcnow()

Get the current UTC time.

Returns

A DateTime object representing the current UTC time

class experimental.rtc.Timezone(hours, minutes)

Represents a timezone shift relative to UTC

We allow minutes & hours, since there are 15-, 30-, and 45-minute timzeones in the world

class experimental.rtc.Weekday

Container class for weekday names

ISO 8601 specifies the week starts on Monday (1) and ends on Sunday (7)