mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-12-03 21:10:30 +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:
parent
f5b69dce0b
commit
4b2953125b
Notes:
sideshowbarker
2024-07-18 05:23:22 +09:00
Author: https://github.com/gateway2000 🔰 Commit: https://github.com/SerenityOS/serenity/commit/4b2953125bd Pull-request: https://github.com/SerenityOS/serenity/pull/9566
1 changed files with 2 additions and 2 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue