AK: Put an empty new line between function definitions in AK::Time

There was over 110 lines without a single line break, let's give our
eyes a break.
This commit is contained in:
Timothy Flynn 2022-01-18 16:57:16 -05:00 committed by Linus Groh
parent 7d521b7c7c
commit bc719e7bac
Notes: sideshowbarker 2024-07-17 20:38:03 +09:00

View file

@ -44,6 +44,7 @@ Time Time::from_timespec(const struct timespec& ts)
i32 extra_secs = sane_mod(nsecs, 1'000'000'000);
return Time::from_half_sanitized(ts.tv_sec, extra_secs, nsecs);
}
Time Time::from_timeval(const struct timeval& tv)
{
i32 usecs = tv.tv_usec;
@ -61,6 +62,7 @@ i64 Time::to_truncated_seconds() const
}
return m_seconds;
}
i64 Time::to_truncated_milliseconds() const
{
VERIFY(m_nanoseconds < 1'000'000'000);
@ -79,6 +81,7 @@ i64 Time::to_truncated_milliseconds() const
return milliseconds.value();
return m_seconds < 0 ? -0x8000'0000'0000'0000LL : 0x7fff'ffff'ffff'ffffLL;
}
i64 Time::to_truncated_microseconds() const
{
VERIFY(m_nanoseconds < 1'000'000'000);
@ -97,6 +100,7 @@ i64 Time::to_truncated_microseconds() const
return microseconds.value();
return m_seconds < 0 ? -0x8000'0000'0000'0000LL : 0x7fff'ffff'ffff'ffffLL;
}
i64 Time::to_seconds() const
{
VERIFY(m_nanoseconds < 1'000'000'000);
@ -107,6 +111,7 @@ i64 Time::to_seconds() const
}
return m_seconds;
}
i64 Time::to_milliseconds() const
{
VERIFY(m_nanoseconds < 1'000'000'000);
@ -123,6 +128,7 @@ i64 Time::to_milliseconds() const
return milliseconds.value();
return m_seconds < 0 ? -0x8000'0000'0000'0000LL : 0x7fff'ffff'ffff'ffffLL;
}
i64 Time::to_microseconds() const
{
VERIFY(m_nanoseconds < 1'000'000'000);
@ -139,6 +145,7 @@ i64 Time::to_microseconds() const
return microseconds.value();
return m_seconds < 0 ? -0x8000'0000'0000'0000LL : 0x7fff'ffff'ffff'ffffLL;
}
i64 Time::to_nanoseconds() const
{
VERIFY(m_nanoseconds < 1'000'000'000);
@ -153,11 +160,13 @@ i64 Time::to_nanoseconds() const
return nanoseconds.value();
return m_seconds < 0 ? -0x8000'0000'0000'0000LL : 0x7fff'ffff'ffff'ffffLL;
}
timespec Time::to_timespec() const
{
VERIFY(m_nanoseconds < 1'000'000'000);
return { static_cast<time_t>(m_seconds), static_cast<long>(m_nanoseconds) };
}
timeval Time::to_timeval() const
{
VERIFY(m_nanoseconds < 1'000'000'000);
@ -239,14 +248,17 @@ bool Time::operator<(const Time& other) const
{
return m_seconds < other.m_seconds || (m_seconds == other.m_seconds && m_nanoseconds < other.m_nanoseconds);
}
bool Time::operator<=(const Time& other) const
{
return m_seconds < other.m_seconds || (m_seconds == other.m_seconds && m_nanoseconds <= other.m_nanoseconds);
}
bool Time::operator>(const Time& other) const
{
return m_seconds > other.m_seconds || (m_seconds == other.m_seconds && m_nanoseconds > other.m_nanoseconds);
}
bool Time::operator>=(const Time& other) const
{
return m_seconds > other.m_seconds || (m_seconds == other.m_seconds && m_nanoseconds >= other.m_nanoseconds);
@ -283,6 +295,7 @@ static Time now_time_from_clock(clockid_t clock_id)
return Time::from_timespec(now_spec);
}
}
Time Time::now_realtime()
{
return now_time_from_clock(CLOCK_REALTIME);