Skip to content

Expose Timer's Expiration Time #131

@Felix-El

Description

@Felix-El

After waiting on/polling for a timer's completion, I would want to know which time it is now, without potential overhead of calling try_now() again.

This story actually asks for two instants:

  • one is the ideal expiration instant which is a private data member of Timers already
  • the other is the actual instant read from the Clock and found to be greater than or equal the ideal one during the query

Both instants are available to _is_expired() which serves period_complete of Periodic and is_expired of OneShot.

Considering the Ok result case, instead of returning a bool (expired or not), we should return Option((ideal_instant, actual_instant)).
Extracting the ideal_instant from the Periodic timer's period_complete is particularly useful because it gets updated for the next cycle inside this very function and inspecting expired would already contain the next instant (if it was exposed via accessor).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @Felix-El

        Issue actions

          Expose Timer's Expiration Time · Issue #131 · FluenTech/embedded-time