Skip to content

Conversation

@Rajveer100
Copy link

Objective

Resolves #21860

This new method would tick the timer by duration - 1 ns leaving a very short waiting time for the first tick initiated by the user allowing immediate action.

Solution

The almost_finish method updates the timer by ticking it with 1ns remaining.

Testing

Tests have been added in almost_finished_repeating.

@Rajveer100
Copy link
Author

cc @alice-i-cecile

action

Resolves bevyengine#21860

This new method would tick the timer by `duration - 1 ns` leaving a
very short waiting time for the first tick initiated by the user allowing
immediate action.
@alice-i-cecile alice-i-cecile added C-Usability A targeted quality-of-life change that makes Bevy easier to use A-Time Involves time keeping and reporting S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Nov 30, 2025
}

/// Almost finishes the timer leaving 1 ns of remaining time.
///
Copy link
Member

Choose a reason for hiding this comment

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

Please add another line here explaining why this method would be useful.

duration: Duration,
mode: TimerMode,
finished: bool,
almost_finished: bool,
Copy link
Member

Choose a reason for hiding this comment

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

I don't think we need this field at all: simply setting the duration remaining to 1 ns should do the trick directly without adding complexity / wasted data.

Copy link
Member

@alice-i-cecile alice-i-cecile left a comment

Choose a reason for hiding this comment

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

I think we can + should get rid of the bool, but I like the 1 ns solution!

@alice-i-cecile alice-i-cecile added S-Waiting-on-Author The author needs to make changes or address concerns before this can be merged and removed S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Nov 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-Time Involves time keeping and reporting C-Usability A targeted quality-of-life change that makes Bevy easier to use S-Waiting-on-Author The author needs to make changes or address concerns before this can be merged

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Repeated Timer that fires immediately after creation

2 participants