Skip to content
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

raspberrypi: RTC: Ensure a time is set #4379

Merged
merged 1 commit into from
Mar 11, 2021
Merged

Conversation

jepler
Copy link
Member

@jepler jepler commented Mar 10, 2021

Until a time is set, the RTC is not running, and rtc_get_datetime() returns false without assigning to the out-parameter.

In CircuitPython, this would manifest as arbitrary values being returned by rtc.RTC().datetime, since uninitialized storage on the stack was being converted into a timestamp.

After this change, the RTC starts on January 1, 2020. I think this is the same epoch as the other ports.

tannewt
tannewt previously approved these changes Mar 11, 2021
Copy link
Member

@tannewt tannewt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Just needs make translate

Until a time is set, the RTC is not running, and rtc_get_datetime()
returns false without assigning to the out-parameter.

In CircuitPython, this would manifest as arbitrary values being returned,
since uninitialized storage on the stack was being converted into a timestamp.
@jepler
Copy link
Member Author

jepler commented Mar 11, 2021

@tannewt I had to update the branch so I'll need a re-review. thank you!

@jepler jepler requested a review from tannewt March 11, 2021 02:49
Copy link
Collaborator

@microdev1 microdev1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! @jepler. I am wondering if this will fix #4260.

@jepler
Copy link
Member Author

jepler commented Mar 11, 2021

@microdev1 I don't know, I would think that after set_time_source, this routine wouldn't be used anymore. I could be wrong.

@jepler jepler merged commit 15e97f1 into adafruit:main Mar 11, 2021
@jepler jepler deleted the rp2040-rtc branch November 3, 2021 21:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants