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

How to get an instance of Clock? #130

Open
schubart opened this issue Nov 26, 2022 · 0 comments
Open

How to get an instance of Clock? #130

schubart opened this issue Nov 26, 2022 · 0 comments

Comments

@schubart
Copy link

I have a program that runs on a Raspberry Pi 4 and uses std::time::Instant. I want to change it to no_std so I can try and make it run on smaller devices. embedded-time::clock::Clock seems to be a no_std alternative to std::time::Instant.

However, Clock is just a trait and I can't figure out how to create an instance of it. Do I need to use an additional crate, perhaps specific to Raspberry Pi, that provides an implementation of Clock? How do I find such a crate? I tried searching crates.io for crates that depend on embedded-time, but there are many results and none seemed applicable.

For what it's worth, my program needs to repeatedly check how much time has passed since some start. So I don't need UTC or complex calendar logic or anything like that. embedded-time::timer::Timer::is_expired sounds ideal for me.

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

No branches or pull requests

1 participant