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

apis/alarm: Support getting the current time #548

Merged
merged 1 commit into from
Jun 11, 2024

Conversation

alistair23
Copy link
Collaborator

No description provided.


pub fn get_milliseconds() -> Result<u64, ErrorCode> {
let ticks = Self::get_ticks()? as u64;
let freq = (Self::get_frequency()?).0 as u64;
Copy link
Member

Choose a reason for hiding this comment

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

It's a real bummer that this would induce an additional system call each time, even though the frequency generally won't chance. Seems like this is a good place for a lazily initialized static or something...

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It's a good use case for the read only syscalls as well. But libtock-rs currently doesn't support them

@alevy alevy added this pull request to the merge queue Jun 11, 2024
Merged via the queue into tock:master with commit fc7c132 Jun 11, 2024
3 checks passed
@alistair23 alistair23 deleted the alistair/time branch June 11, 2024 22:07
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.

2 participants