8000 docs/library/machine.RTC.rst: Document datetime method and fix ex code. · micropython/micropython@c0499bc · GitHub
[go: up one dir, main page]

Skip to content

Commit c0499bc

Browse files
peterhinchdpgeorge
authored andcommitted
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.
1 parent da8aad1 commit c0499bc

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

docs/library/machine.RTC.rst

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ and time.
1010
Example usage::
1111

1212
rtc = machine.RTC()
13-
rtc.init((2014, 5, 1, 4, 13, 0, 0, 0))
14-
print(rtc.now())
13+
rtc.datetime((2020, 1, 21, 2, 10, 32, 36, 0))
14+
print(rtc.datetime())
1515

1616

1717
Constructors
@@ -24,6 +24,20 @@ Constructors
2424
Methods
2525
-------
2626

27+
.. method:: RTC.datetime([datetimetuple])
28+
29+
Get or set the date and time of the RTC.
30+
31+
With no arguments, this method returns an 8-tuple with the current
32+
date and time. With 1 argument (being an 8-tuple) it sets the date
33+
and time.
34+
35+
The 8-tuple has the following format:
36+
37+
(year, month, day, weekday, hours, minutes, seconds, subseconds)
38+
39+
The meaning of the ``subseconds`` field is hardware dependent.
40+
2741
.. method:: RTC.init(datetime)
2842

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

0 commit comments

Comments
 (0)
0