Adjusted documentation and reset_after behaviour.

This commit is contained in:
Frostie314159 2023-12-11 16:11:57 +01:00
parent 663fa2addd
commit 8707462ec2
No known key found for this signature in database
GPG Key ID: 0C2C22C244C8223F

View File

@ -185,13 +185,15 @@ impl Ticker {
} }
/// Reset the ticker to fire for the next time on the deadline. /// Reset the ticker to fire for the next time on the deadline.
/// If the deadline is in the past, the ticker will fire instantly.
pub fn reset_at(&mut self, deadline: Instant) { pub fn reset_at(&mut self, deadline: Instant) {
self.expires_at = deadline; self.expires_at = deadline;
} }
/// Resets the ticker, after the specified duration has passed. /// Resets the ticker, after the specified duration has passed.
/// If the specified duration is zero, the next tick will be after the duration of the ticker.
pub fn reset_after(&mut self, after: Duration) { pub fn reset_after(&mut self, after: Duration) {
self.expires_at = Instant::now() + after; self.expires_at = Instant::now() + after + self.duration;
} }
/// Waits for the next tick. /// Waits for the next tick.