GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Correct tick overflow handling for timer reset by mark9064 · Pull Request #2149 · InfiniTimeOrg/InfiniTime

Conversation

@mark9064

@mark9064 mark9064 commented Oct 27, 2024

Copy link
Copy Markdown
Member

Imagine the tick count wraps around at 1000, the hold time is set to 150, and the current time is 900. With the current code the comparison becomes 900 > 900 + 150 which is 900 > 50 as (1050 % 1000 = 50) so the condition will immediately be true.

With the new code, the comparison becomes 0 > 150 so there is no problem.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@mark9064
Correct tick overflow handling for timer reset
dd3de92
@github-actions

github-actions Bot commented Oct 27, 2024

Copy link
Copy Markdown

Build size and comparison to main:

Section Size Difference
text 374544B -16B
data 948B 0B
bss 63488B 0B
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@mark9064 mark9064 added the maintenance Background work label Oct 20, 2025
@mark9064 mark9064 added this to the 1.16.0 milestone Oct 20, 2025
JF002
JF002 approved these changes Nov 4, 2025
View reviewed changes
@minacode

minacode commented Nov 5, 2025

Copy link
Copy Markdown
Contributor

Don't you get the same problem now, just the other way around?

1050 gets 50 and then you check 50 - 900 > 150 which can never be true.
Or is 50 - 900 negatively overflowing to some large positive number as well?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@mark9064

mark9064 commented Nov 5, 2025

Copy link
Copy Markdown
Member Author

Yeah you get that negative wraparound. So 50 - 900 is 150

Crucially, t2 - t1 will always give you the correct duration between them in ticks (provided t2 is in the future from t1, and less than one wraparound of ticks has elapsed). When you know the duration, you can compare that with a constant without issue

minacode reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@mark9064
mark9064 merged commit 3a1f4fe into InfiniTimeOrg:main Nov 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@JF002 JF002 JF002 approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

maintenance Background work

Projects

None yet

Milestone

1.16.0

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@mark9064 @minacode @JF002
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.