Setting RTC subseconds

General discussions and questions abound development of code with MicroPython that is not hardware specific.
Target audience: MicroPython Users.
Post Reply
kwiley
Posts: 140
Joined: Wed May 16, 2018 5:53 pm
Contact:

Setting RTC subseconds

Post by kwiley » Fri Apr 09, 2021 2:51 pm

The docs say this:

----------
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 (and subseconds is reset to 255).

The 8-tuple has the following format:

(year, month, day, weekday, hours, minutes, seconds, subseconds)
----------

The implication is that you can't set the RTC subseconds. It is initialized to 255, or exactly the top of the second. You simply must make the call to set the time at the top of the second. However, it also says the argument is an 8-tuple including the 1/256th subsecond. Are the docs supposed to say that while it returns an 8-tuple showing the subseconds (which I have confirmed does indeed show subsecond precision), it only accepts a 7-tuple, such that any included 8th parameter that would intend a subsecond value is actually ignored? Or are the docs right in some sense and passing a subseconds value in at the 8th position has some sort of effect on the RTC?

When setting the RTC, does the 8th parameter, the subseconds, do anything?

Post Reply