MXL : Media eXchange Layer
MXL
Loading...
Searching...
No Matches
Time.cpp
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2025 Contributors to the Media eXchange Layer project.
2// SPDX-License-Identifier: Apache-2.0
3
5#include <ctime>
6
7bool operator==(timespec const& lhs, timespec const& rhs)
8{
9 return (lhs.tv_sec == rhs.tv_sec) && (lhs.tv_nsec == rhs.tv_nsec);
10}
11
12bool operator!=(timespec const& lhs, timespec const& rhs)
13{
14 return !(lhs == rhs);
15}
16
17bool operator<(timespec const& lhs, timespec const& rhs)
18{
19 if (lhs.tv_sec < rhs.tv_sec)
20 {
21 return true;
22 }
23 if (lhs.tv_sec > rhs.tv_sec)
24 {
25 return false;
26 }
27 return lhs.tv_nsec < rhs.tv_nsec;
28}
29
30bool operator<=(timespec const& lhs, timespec const& rhs)
31{
32 return (lhs < rhs) || (lhs == rhs);
33}
34
35bool operator>(timespec const& lhs, timespec const& rhs)
36{
37 return !(lhs <= rhs);
38}
39
40bool operator>=(timespec const& lhs, timespec const& rhs)
41{
42 return !(lhs < rhs);
43}
bool operator>(timespec const &lhs, timespec const &rhs)
Definition Time.cpp:35
bool operator==(timespec const &lhs, timespec const &rhs)
Definition Time.cpp:7
bool operator>=(timespec const &lhs, timespec const &rhs)
Definition Time.cpp:40
bool operator!=(timespec const &lhs, timespec const &rhs)
Definition Time.cpp:12
bool operator<=(timespec const &lhs, timespec const &rhs)
Definition Time.cpp:30
bool operator<(timespec const &lhs, timespec const &rhs)
Definition Time.cpp:17