Skip to content

fix: fix timer in Update timer.rs#439

Closed
HarleyQeen wants to merge 1 commit intonexus-xyz:mainfrom
HarleyQeen:patch-1
Closed

fix: fix timer in Update timer.rs#439
HarleyQeen wants to merge 1 commit intonexus-xyz:mainfrom
HarleyQeen:patch-1

Conversation

@HarleyQeen
Copy link
Contributor

The Timer component was using a last_tick field to compute elapsed time, which was only initialized in new() and never updated during normal execution. This caused the timer to always display the same duration instead of the actual time since the action began.

Fix:

Removed the unused last_tick field.

Replaced last_tick.elapsed() with start.elapsed() to correctly reflect time since the action started.

Simplified the logic in finalize() by removing unnecessary state reset.

Why:
start.elapsed() is sufficient for showing total elapsed time, and avoids redundant state tracking. This change makes the timer behave as expected and keeps the code cleaner.

The Timer component was using a last_tick field to compute elapsed time, which was only initialized in new() and never updated during normal execution. This caused the timer to always display the same duration instead of the actual time since the action began.

Fix:

Removed the unused last_tick field.

Replaced last_tick.elapsed() with start.elapsed() to correctly reflect time since the action started.

Simplified the logic in finalize() by removing unnecessary state reset.

Why:
start.elapsed() is sufficient for showing total elapsed time, and avoids redundant state tracking. This change makes the timer behave as expected and keeps the code cleaner.
@github-actions
Copy link


Thank you for your submission, we really appreciate it. Like many open-source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution. You can sign the CLA by just posting a Pull Request Comment same as the below format.


I have read the CLA Document and I hereby sign the CLA


You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot.

@sjudson
Copy link
Contributor

sjudson commented Jul 25, 2025

Duplicate of #425

@sjudson sjudson marked this as a duplicate of #425 Jul 25, 2025
@sjudson sjudson closed this Jul 25, 2025
@github-actions github-actions bot locked and limited conversation to collaborators Jul 25, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants