From c0499bc2b9a7b4ceb1e0bdd65e900be162810d3d Mon Sep 17 00:00:00 2001 From: Peter Hinch Date: Tue, 21 Jan 2020 10:36:08 +0000 Subject: [PATCH] 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. --- docs/library/machine.RTC.rst | 18 ++++++++++++++++-- 1 file 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: