mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-25 09:00:22 +00:00
AK: Define compound subtraction operator for UnixDateTime
This commit is contained in:
parent
b3d5f9748a
commit
2437064820
Notes:
sideshowbarker
2024-07-16 20:39:14 +09:00
Author: https://github.com/trflynn89 Commit: https://github.com/SerenityOS/serenity/commit/2437064820 Pull-request: https://github.com/SerenityOS/serenity/pull/21833
1 changed files with 7 additions and 0 deletions
|
@ -439,7 +439,14 @@ public:
|
||||||
this->m_offset = this->m_offset + other;
|
this->m_offset = this->m_offset + other;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr UnixDateTime operator-(Duration const& other) const { return UnixDateTime { m_offset - other }; }
|
constexpr UnixDateTime operator-(Duration const& other) const { return UnixDateTime { m_offset - other }; }
|
||||||
|
constexpr UnixDateTime& operator-=(Duration const& other)
|
||||||
|
{
|
||||||
|
m_offset = m_offset - other;
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
// Subtracting two UNIX times yields their time difference.
|
// Subtracting two UNIX times yields their time difference.
|
||||||
constexpr Duration operator-(UnixDateTime const& other) const { return m_offset - other.m_offset; }
|
constexpr Duration operator-(UnixDateTime const& other) const { return m_offset - other.m_offset; }
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue