1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

OpenGL: Avoid signed integer truncation when computing frame time differences

This commit is contained in:
reuk 2023-05-30 13:11:25 +01:00
parent 604e090372
commit 722b552657
No known key found for this signature in database
GPG key ID: FCB43929F012EE5C

View file

@ -180,7 +180,8 @@ public:
// and sleeps if necessary.
auto swapTime = Time::getMillisecondCounterHiRes() - now;
auto frameTime = (int) (now - lastSwapTime);
auto frameTime = (int) std::min ((uint64_t) std::numeric_limits<int>::max(),
(uint64_t) now - (uint64_t) lastSwapTime);
if (swapTime < 0.5 && frameTime < minSwapTime - 3)
{