← index #3830PR #5553
Related · high · value 2.629
QUERY · ISSUE

No format of tzinfo accepted in RTC.init()

openby VipSaranopened 2018-05-31updated 2018-06-01

Documentation defines RTC.init() method accepting tzinfo argument:

.. method:: RTC.init(datetime)

   Initialise the RTC. Datetime is a tuple of the form:

      ``(year, month, day[, hour[, minute[, second[, microsecond[, tzinfo]]]]])``

But not just that that docu doesn't specify format (Object/String) of the tzinfo it also "doesn't work".

CANDIDATE · PULL REQUEST

docs/library/machine.RTC.rst Fix example code, document datetime method.

closedby peterhinchopened 2020-01-21updated 2023-01-25
docs

This is the minimum change to fix the example code so it actually runs.

Unfortunately documenting the RTC class is difficult because it has been implemented differently for each platform. I checked STM, ESP8266 and ESP32. All implement datetime. Implementation of init is platform dependent: STM accepts no args. ESP8266 does not implement it while ESP32 requires a datetime tuple. Further, each platform implements a different set of methods and some documented methods are not implemented on any of these platforms: for example the now method.

Methods such as calibrate are inherently hardware dependent but where a method is implemented across platforms its calling signature should (in my view) be consistent.

There are other platforms where I don't own hardware so can't test. I'm stumped as to how properly to document this class.

Keyboard

j / / n
next pair
k / / p
previous pair
1 / / h
show query pane
2 / / l
show candidate pane
c
copy suggested comment
r
toggle reasoning
g i
go to index
?
show this help
esc
close overlays

press ? or esc to close

copied