Skip to content

How to get an instance of Clock? #130

@schubart

Description

@schubart

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions