diff options
| author | Peter Hinch <peter@hinch.me.uk> | 2020-01-21 10:36:08 +0000 |
|---|---|---|
| committer | Damien George <damien@micropython.org> | 2021-06-12 22:53:49 +1000 |
| commit | c0499bc2b9a7b4ceb1e0bdd65e900be162810d3d (patch) | |
| tree | 89ef1ccd98829c426db1a464a7fdc6e815de7e76 | |
| parent | da8aad18a4508476aa041406c0b06f5df4a8e59b (diff) | |
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.
| -rw-r--r-- | docs/library/machine.RTC.rst | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/docs/library/machine.RTC.rst b/docs/library/machine.RTC.rst index ae5446ef7..be2be2eee 100644 --- a/docs/library/machine.RTC.rst +++ b/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: |
