You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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).
The text was updated successfully, but these errors were encountered:
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:
Both instants are available to
_is_expired()
which servesperiod_complete
ofPeriodic
andis_expired
ofOneShot
.Considering the
Ok
result case, instead of returning abool
(expired or not), we should returnOption((ideal_instant, actual_instant))
.Extracting the
ideal_instant
from thePeriodic
timer'speriod_complete
is particularly useful because it gets updated for the next cycle inside this very function and inspectingexpired
would already contain the next instant (if it was exposed via accessor).The text was updated successfully, but these errors were encountered: