Skip to content

RTC does not track tm_isdst #7752

Open
Open
@ilikecake

Description

@ilikecake

CircuitPython version

Adafruit CircuitPython 8.0.3 on 2023-02-23; Adafruit Feather ESP32S3 4MB Flash 2MB PSRAM with ESP32S3

Code/REPL

import time
import rtc

nowtime = time.struct_time((2023, 3, 18, 13, 47, 28, 5, 77, 1))
rtc.RTC().datetime = nowtime
now = time.localtime()
print("Time sent to RTC:", nowtime)
print("Time from RTC:", now)

nowtime = time.struct_time((2023, 3, 18, 13, 47, 28, 5, 77, 0))
rtc.RTC().datetime = nowtime
now = time.localtime()
print("Time sent to RTC:", nowtime)
print("Time from RTC:", now)

Behavior

Time sent to RTC: struct_time(tm_year=2023, tm_mon=3, tm_mday=18, tm_hour=13, tm_min=47, tm_sec=28, tm_wday=5, tm_yday=77, tm_isdst=1)
Time from RTC: struct_time(tm_year=2023, tm_mon=3, tm_mday=18, tm_hour=13, tm_min=47, tm_sec=28, tm_wday=5, tm_yday=77, tm_isdst=-1)
Time sent to RTC: struct_time(tm_year=2023, tm_mon=3, tm_mday=18, tm_hour=13, tm_min=47, tm_sec=28, tm_wday=5, tm_yday=77, tm_isdst=0)
Time from RTC: struct_time(tm_year=2023, tm_mon=3, tm_mday=18, tm_hour=13, tm_min=47, tm_sec=28, tm_wday=5, tm_yday=77, tm_isdst=-1)

Description

When setting the time in the RTC, the tm_isdst member of the struct is not set. In the above example, I set it to 1 (DST applied) or 0 (DST not applied), but the RTC always returns -1.

I am not expecting the RTC to handle the time change from DST, but I was expecting it to store that variable so that my code can use it to check if DST has been implemented.

Alternatively, if tm_isdst cannot be saved for some reason, please update the documentation here so that we know what to expect.

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugcpython apimodules from cpythonespressifapplies to multiple Espressif chips

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions