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

Add current_time #1503

Merged
merged 4 commits into from
Apr 23, 2024
Merged

Add current_time #1503

merged 4 commits into from
Apr 23, 2024

Conversation

bjoernQ
Copy link
Contributor

@bjoernQ bjoernQ commented Apr 23, 2024

Thank you for your contribution!

We appreciate the time and effort you've put into this pull request.
To help us review it efficiently, please ensure you've gone through the following checklist:

Submission Checklist 📝

  • I have updated existing examples or added new ones (if applicable).
  • My changes were added to the CHANGELOG.md in the proper section.

Extra:

Pull Request Details 📖

Description

Closes #1139

This adds time::current_time to get the system uptime.

On ESP32 it uses the (mostly undocumented) LAC timer - same as esp-idf.
On all other chips it uses Systimer.

Testing

The timer_interrupt example is changed to use the API.

I also changed esp-wifi to use it and everything worked fine. (It might also improve performance on Xtensa targets but I didn't benchmark it)

@MabezDev
Copy link
Member

I've tried this out locally and all is working fine!

Could we add a small basic test case to assert that current_time increases? I know its simple, but it will at least tell us if for whatever reason (most likely on the esp32) if it broke. Having this break would be pretty bad for esp-wifi :D

Copy link
Contributor

@JurajSadel JurajSadel left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

Copy link
Member

@jessebraham jessebraham left a comment

Choose a reason for hiding this comment

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

Thanks for taking care of this!

@jessebraham jessebraham added this pull request to the merge queue Apr 23, 2024
Merged via the queue into esp-rs:main with commit 373735f Apr 23, 2024
21 checks passed
@bjoernQ bjoernQ deleted the get-time-api branch November 26, 2024 08:41
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.

Provide an API to get reliable system uptime
4 participants