Browse Source

docs/library/machine.RTC.rst: Document datetime method and fix ex code.

This is the minimum change to fix the example code so it actually runs on
the majority of ports.
pull/7396/head
Peter Hinch 5 years ago
committed by Damien George
parent
commit
c0499bc2b9
  1. 18
      docs/library/machine.RTC.rst

18
docs/library/machine.RTC.rst

@ -10,8 +10,8 @@ and time.
Example usage::
rtc = machine.RTC()
rtc.init((2014, 5, 1, 4, 13, 0, 0, 0))
print(rtc.now())
rtc.datetime((2020, 1, 21, 2, 10, 32, 36, 0))
print(rtc.datetime())
Constructors
@ -24,6 +24,20 @@ Constructors
Methods
-------
.. method:: RTC.datetime([datetimetuple])
Get or set the date and time of the RTC.
With no arguments, this method returns an 8-tuple with the current
date and time. With 1 argument (being an 8-tuple) it sets the date
and time.
The 8-tuple has the following format:
(year, month, day, weekday, hours, minutes, seconds, subseconds)
The meaning of the ``subseconds`` field is hardware dependent.
.. method:: RTC.init(datetime)
Initialise the RTC. Datetime is a tuple of the form:

Loading…
Cancel
Save