rtc.datetime() : OSError: [Errno 22] EINVAL #10616
-
example code:
code output:
have tried using firmware 1.18 and 1.19.1. the code run fine on esp32 port. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
time.localtime() and rtc.datetime() have a different format for the datetime tuple. See e.g. issues #10578 or #5553 and many more. |
Beta Was this translation helpful? Give feedback.
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.