Skip to content

rtc.datetime() : OSError: [Errno 22] EINVAL #10616

Discussion options

You must be logged in to vote

time.localtime() and rtc.datetime() have a different format for the datetime tuple. See e.g. issues #10578 or #5553 and many more.
Or the documentation at https://docs.micropython.org/en/latest/library/time.html?highlight=time%20localtime#time.localtime and https://docs.micropython.org/en/latest/library/machine.RTC.html?highlight=datetime#machine.RTC.datetime.
rtc.datetime() is as well different from CPython's datetime.datetime() method.
Applying time.localtime() to rtc.datetime() may or may not cause an exception, depending on the port's implementation, but in any case the result is wrong.

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@puppet13th
Comment options

@robert-hh
Comment options

@puppet13th
Comment options

Answer selected by puppet13th
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants