mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-06 00:25:12 +00:00
AK: Use POSIX specified types for Time::to_timespec and to_timeval
The previous implementation assumed 64-bit time_t and 32-bit long, which is not true on some 32-bit systems
This commit is contained in:
committed by
Andreas Kling
parent
f5b69dce0b
commit
4b2953125b
@@ -170,12 +170,12 @@ i64 Time::to_nanoseconds() const
|
||||
timespec Time::to_timespec() const
|
||||
{
|
||||
VERIFY(m_nanoseconds < 1'000'000'000);
|
||||
return { static_cast<i64>(m_seconds), static_cast<i32>(m_nanoseconds) };
|
||||
return { static_cast<time_t>(m_seconds), static_cast<long>(m_nanoseconds) };
|
||||
}
|
||||
timeval Time::to_timeval() const
|
||||
{
|
||||
VERIFY(m_nanoseconds < 1'000'000'000);
|
||||
return { static_cast<i64>(m_seconds), static_cast<i32>(m_nanoseconds) / 1000 };
|
||||
return { static_cast<time_t>(m_seconds), static_cast<suseconds_t>(m_nanoseconds) / 1000 };
|
||||
}
|
||||
|
||||
Time Time::operator+(const Time& other) const
|
||||
|
||||
Reference in New Issue
Block a user