Skip to content

Conversation

@themuffinator
Copy link
Owner

Summary

  • add documentation comment for Sys_Milliseconds
  • handle QueryPerformanceCounter failures by logging and falling back to timeGetTime while keeping monotonic timing

Testing

  • not run (not requested)

Codex Task

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +1465 to +1472
Sys_Printf("QueryPerformanceCounter failed; falling back to timeGetTime (low resolution).\n");
qpc_available = false;
fallback_base = timeGetTime();
}

DWORD current = timeGetTime();
unsigned msec = current - fallback_base;
if (msec < last_msec)

Choose a reason for hiding this comment

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

P1 Badge Fallback timer never advances after QPC failure

When QueryPerformanceCounter fails, fallback_base is set to the current timeGetTime() while last_msec still holds the absolute QPC-derived milliseconds since boot. The very next call computes msec = current - fallback_base (near zero) and clamps it to last_msec, but fallback_base is not offset by that value. The result is that Sys_Milliseconds returns a constant last_msec until timeGetTime() has advanced by at least that many milliseconds—potentially freezing the timer for many minutes or hours after the fallback is triggered. Consider seeding fallback_base so timeGetTime() continues from last_msec immediately.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants