Skip to content

Conversation

@esfacumon
Copy link

This PR Fixes #1587.

This bug, as @fy said, was caused by Time::getMillisecondCounter(), which returns a 32-bit integer. This value overflows after approximately 49.7 days of system uptime, causing incorrect timestamp calculations.

This replaces the Time::getMillisecondCounter() call with (int64) Time::getMillisecondCounterHiRes(). This uses a 64-bit timer, resolving the bug.

(This PR also includes a preliminary commit to fix CRLF line endings in the modified file.)

@jrlanglois
Copy link

Whatever the line-endings were before you made changes I recommend being consistent. It's not possible to know what the actual diff is without grabbing the raw text and bringing it locally. Also, it looks like you have git conflicts meaning you'll need to merge/rebase.

Anyway, I think this bug extends beyond just macOS; on iOS, it seems like it could be the same bug.

    static int64 getMouseTime (NSTimeInterval timestamp) noexcept
    {
        return (Time::currentTimeMillis() - Time::getMillisecondCounter())
             + (int64) (timestamp * 1000.0);
    }

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants