-
Couldn't load subscription status.
- Fork 177
Closed
Description
Hi! I think it would be nice to add a DelayUntil utility to delays. In this way, we can have actual periodic tasks, regardless of the time consumed by a task when executing. To do so, we would need to add the following methods to delays:
get_tick(&self) -> u32(I'm not sure which the return value should be): it returns the current internal clock tick value.delay_until_ms(&mut self, tick_from: u32, ms: u16): it waits the given amount of milliseconds FROM THE BASELINE.delay_until_us(&mut self, tick_from: u32, us: u32): it waits the given amount of microseconds FROM THE BASELINE.
With that, we could do something like this:
let tick = timer.get_tick(); // tick now represents the time
do_stuff(); // this takes time...
timer.delay_until_ms(tick, 1_000); // we wait one second starting from before we triggered do_stuffThus, we would not delay for one second, but 1 second SINCE WE CAPTURED THE BASELINE.
What do you think? Is there anything I'm missing that makes this a bad idea?
Metadata
Metadata
Assignees
Labels
No labels