Skip to content

Commit

Permalink
platform: fix measuring time until DisplayBuffer pending flush
Browse files Browse the repository at this point in the history
  • Loading branch information
magiblot committed Oct 22, 2024
1 parent cafeca0 commit c065756
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions source/platform/dispbuff.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,13 +136,12 @@ bool DisplayBuffer::timeToFlush() noexcept
int DisplayBuffer::timeUntilPendingFlushMs() noexcept
{
using namespace std::chrono;
if (pendingFlush != TimePoint())
{
auto time = pendingFlush - Clock::now();
if (time >= milliseconds::zero())
return duration_cast<milliseconds>(time).count();
}
return -1;
if (pendingFlush == TimePoint())
return -1;
auto now = Clock::now();
if (pendingFlush < now)
return 0;
return duration_cast<milliseconds>(pendingFlush - now).count();
}

void DisplayBuffer::setCursorPosition(int x, int y) noexcept
Expand Down

0 comments on commit c065756

Please sign in to comment.