Skip to content

time: Clarify MissedTickBehavior documentation#7941

Open
chrisduerr wants to merge 1 commit intotokio-rs:masterfrom
chrisduerr:tick_docs
Open

time: Clarify MissedTickBehavior documentation#7941
chrisduerr wants to merge 1 commit intotokio-rs:masterfrom
chrisduerr:tick_docs

Conversation

@chrisduerr
Copy link
Copy Markdown

Currently the missed tick behavior's text is not clear on whether the next tick after a missed tick will fire immediately, or if some behaviors could have the missed ticks ignored completely and wait until the next tick instead.

The graphics and code examples already portray this correctly, but making this statement in plain text should hopefully clarify any potential confusion.

This also removes the following section from the Skip behavior documentation:

unlike [Burst], the ticks may not be one multiple of period away
from the last tick.

From my understanding, this comment is inaccurate. Neither burst nor skip are guaranteed to have ticks one multiple of period away from the last tick (it could be less for both). Both burst and skip also will never have ticks longer than one interval. Maybe this was a typo and it was meant to say Delay instead?

Currently the missed tick behavior's text is not clear on whether the
next tick after a missed tick will fire immediately, or if some
behaviors could have the missed ticks ignored completely and wait until
the next tick instead.

The graphics and code examples already portray this correctly, but
making this statement in plain text should hopefully clarify any
potential confusion.

This also removes the following section from the `Skip` behavior
documentation:

> unlike [`Burst`], the ticks may not be *one* multiple of `period` away
> from the last tick.

From my understanding, this comment is inaccurate. Neither burst nor
skip are guaranteed to have ticks *one* multiple of period away from the
last tick (it could be less for both). Both burst and skip also will
never have ticks *longer* than one interval. Maybe this was a typo and
it was meant to say `Delay` instead?
/// at the next-closest tick that is a multiple of `period` away from
/// `start` (the point where [`Interval`] first ticked). Like [`Burst`], all
/// ticks remain multiples of `period` away from `start`, but unlike
/// [`Burst`], the ticks may not be *one* multiple of `period` away from the
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just realized that this is most likely a typo and meant to say Delay when I wrote the commit message. If someone can confirm this I can change that rather than removing this section entirely.

/// like [`Burst`], the ticks may be shortened to be less than one `period`
/// away from each other.
/// ticks remain multiples of `period` away from `start`. Like [`Delay`],
/// the number of fired ticks are no longer the same as they would have been
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Personally I think rephrasing this as "number of fired ticks" is an improvement compared to just "ticks are no longer the same", especially since a lot of this section talks about duration and not count.

That said, this was mostly a driveby idea I had for rephrasing things, I'm happy to discard if you disagree with this change.

@Darksonn Darksonn added T-docs Topic: documentation A-tokio Area: The main tokio crate M-time Module: tokio/time labels Feb 27, 2026
@mattiapitossi mattiapitossi changed the title Clarify MissedTickBehavior documentation time: Clarify MissedTickBehavior documentation Apr 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-tokio Area: The main tokio crate M-time Module: tokio/time T-docs Topic: documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants