-
-
Notifications
You must be signed in to change notification settings - Fork 8.2k
ports/rtc: Inconsistencies between ports and the documentation. #10578
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
You've probably seen #5553. Fixing this is long overdue but it will break code. Should the |
The section of the documentation which you changed is the only one which matches rtc.datetime(). But all the quickref paragraphs are wrong.My preference is in the post before in the last four bullets. I do not suggest to change rtc.datetime(), since it seems the only part which is consistent over the ports, if implemented at all. |
How about adding a |
Why? rtc.datetime() and time.localtime() use the same hardware clock, if it exists. So there is no benefit in having a rtc,localtime(). |
What I really want, is a simple way of setting the RTC using something like Unix Timestamp. An alternative solution is make a function like |
For the SAMD port I had made an extension for boards without RTC, that you could supply a time value as seconds since epoch as argument to time.localtime() to set the time. But that's non-standard. |
@dpgeorge Do you have a preference about how to proceed with reducing the inconsistencies of machine.RTC. I can at least make an initial PR to fix the documentation of rtc.datetime(), assuming that this method will not be changed. |
Hi! The code works ok, no problem. But the comment should be read: #... eg. 2017/8/23 12:48 As per the class RTC doc, The 8-tuple has the following format: (year, month, day, weekday, hours, minutes, seconds, subseconds) So the time set is 12:48:00 not 1:12:48 |
Uh oh!
There was an error while loading. Please reload this page.
It looks like the machine.rtc() API is different for all ports and to the documentation.
So it seems as if the documentation of rtc.init() and rtc.now() only matches the cc3200 port. I can make that all consistent, but we should agree first on which class methods should be available. So a simple approach would be:
Edit: Created PR #10607
The text was updated successfully, but these errors were encountered: