Commit 49fcadb1 authored by Adriaan de Groot's avatar Adriaan de Groot 💬
Browse files

Fix build on 32-bit systems

The added comment explains it all, really: you can't fit a 32-bit
unsigned into a 32-bit (signed) time_t, but we don't care.
parent bd4a8be3
......@@ -394,9 +394,14 @@ static void pageFlipHandler(int fd, unsigned int frame, unsigned int sec, unsign
auto output = static_cast<DrmOutput *>(data);
// The static_cast<> here are for a 32-bit environment where
// sizeof(time_t) == sizeof(unsigned int) == 4 . Putting @p sec
// into a time_t cuts off the most-significant bit (after the
// year 2038), similarly long can't hold all the bits of an
// unsigned multiplication.
std::chrono::nanoseconds timestamp = convertTimestamp(output->gpu()->presentationClock(),
{ sec, usec * 1000 });
{ static_cast<time_t>(sec), static_cast<long>(usec * 1000) });
if (timestamp == std::chrono::nanoseconds::zero()) {
qCDebug(KWIN_DRM, "Got invalid timestamp (sec: %u, usec: %u) on output %s",
sec, usec, qPrintable(output->name()));
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment