Thanks to visit codestin.com
Credit goes to github.com

Skip to content

ESP32: RTC().init() wrong tuple #12313

Open
@socketpair

Description

@socketpair

https://docs.micropython.org/en/v1.15/library/machine.RTC.html#machine.RTC.init

image

>>> RTC().init((2023,5,6,10,20,30,0,0))
>>> localtime()
(2023, 5, 6, 20, 30, 2, 5, 126)

as you can see, hour(10) is missing when reading back from RTC.

What helps?
inserting zero after day and before hour.

>>> RTC().init((2023,5,6,0,10,20,30,0))
>>> localtime()
(2023, 5, 6, 10, 20, 31, 5, 126)

Definitely bug in ESP32 port (all ports ?), or documentation is wrong.

>>> sys.implementation
(name='micropython', version=(1, 20, 0), _machine='ESP32S3 module with ESP32S3', _mpy=10502)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions