Skip to content

Duration from checked_duration_since cannot be added with Instant? #89

@korken89

Description

@korken89

Hi,

I am working on moving RTIC to embedded time, however the following trivial code gives a weird trait bound error that I need help with.
What is causing this as is there a recommended fix?

Code:

let now = M::now();

match instant.checked_duration_since(&now) {
    None => {
        // ...
    }
    Some(dur) => {
        let new_instant = now + dur; // <-- error

        // ...
    }
}

Error:

error[E0277]: the trait bound `rtic_core::monotonic::Generic<<M as rtic_core::monotonic::Clock>::T>: FixedPoint` is not satisfied
  --> src/tq.rs:71:47
   |
71 |                         let new_instant = now + dur;
   |                                               ^ the trait `FixedPoint` is not implemented for `rtic_core::monotonic::Generic<<M as rtic_core::monotonic::Clock>::T>`
   |
   = note: required because of the requirements on the impl of `Add<rtic_core::monotonic::Generic<<M as rtic_core::monotonic::Clock>::T>>` for `Instant<M>`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions