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.
ESP32 machine.rtc datetime tuple parameters don't match documentation
Micropython documentation: http://docs.micropython.org/en/latest/wipy/library/machine.RTC.html
Shows machine.rtc.init documented with tuple like this:
RTC.init(datetime)
Initialise the RTC. Datetime is a tuple of the form:
(year, month, day[, hour[, minute[, second[, microsecond[, tzinfo]]]]])
However, the code suggests a different order is used: https://github.com/micropython/micropython/blob/master/ports/esp32/machine_rtc.c
timeutils_seconds_since_2000(mp_obj_get_int(items[0]), mp_obj_get_int(items[1]), mp_obj_get_int(items[2]), mp_obj_get_int(items[4]), mp_obj_get_int(items[5]), mp_obj_get_int(items[6]))
Likewise with machine.rtc.datetime actually returns this order of parameters in the tuple:
r.datetime()
(2018, 3, 21, 2, 6, 8, 19, 258907)
r.datetime()
(2018, 3, 21, 2, 6, 8, 22, 828728)
r.datetime()
(2018, 3, 21, 2, 6, 9, 31, 888997)
r.init((2018,3,19,0,7,5,0,0))
r.datetime()
(2018, 3, 19, 0, 7, 5, 4, 368663)
r.datetime()
(2018, 3, 19, 0, 7, 5, 16, 608804)
r.datetime()
(2018, 3, 19, 0, 7, 5, 38, 98816)