esp32 localtime and machine.RTC().datetime() inconformity
see this
https://github.com/micropython/micropython/blob/b33f108cdeb57c9d84e5a4eff5a46aa49c6dd558/ports/esp32/modutime.c#L52
and this
https://github.com/micropython/micropython/blob/b9ec6037edf5e6ff6f8f400d70f7351d1b0af67d/ports/esp32/machine_rtc.c#L105
I know it seems to have been designed, but if I assign values like this, I won't be able to use the following code.
machine.RTC().datetime(time.localtime(546450051)) # 546450051 only a number.
Is there a better way to set seconds to RTC time.
Otherwise I'll fill in the third element to align the structures, is that so?
machine.RTC.init documentation is incorrect
The machine.RTC documentation has some discrepancies.
The ESP8266 machine.RTC modules doesn't appear to have an init function, but rather has a datetime function.
https://github.com/micropython/micropython/blob/8db5d2d1f13aa6413be11bc13c94df72296a0070/ports/esp8266/machine_rtc.c#L127
The order of the arguments to datetime appears to be (year, month, day, wday, hour, minute, seconds, milliseconds)
The ESP32 machine.RTC module
https://github.com/micropython/micropython/blob/8db5d2d1f13aa6413be11bc13c94df72296a0070/ports/esp32/machine_rtc.c#L87
has an init function and a datetime function. The order of the arguments for datetime and init appears to be (year, month, day, hour, minute, seconds, microseconds)
The stm32 machine.RTC module forwards to pyb.RTC
https://github.com/micropython/micropython/blob/8db5d2d1f13aa6413be11bc13c94df72296a0070/ports/stm32/rtc.c#L515
which has an init function and datetime function, but the init function doesn't take any srguments. The datetime function appears to use the order (year, month, day, wday, hour, month, seconds, microseconds)
The documentation documents an init function with arguments in a different order to any of the above and doesnt't mention a datetime function.
And the EPS8266 appears to take milliseconds as the last argument, whereas the others take microseconds.