Add operators
This commit is contained in:
@@ -24,4 +24,34 @@ namespace openVulkanoCpp::Math
|
||||
[[nodiscard]] uint64_t GetNanos() const { return timestamp; }
|
||||
[[nodiscard]] double GetSeconds() const { return timestamp * NANOS_TO_SECONDS; }
|
||||
};
|
||||
|
||||
inline bool operator==(const Timestamp& lhs, const Timestamp& rhs)
|
||||
{
|
||||
return lhs.GetNanos() == rhs.GetNanos();
|
||||
}
|
||||
|
||||
inline bool operator!=(const Timestamp& lhs, const Timestamp& rhs)
|
||||
{
|
||||
return !(lhs == rhs);
|
||||
}
|
||||
|
||||
inline bool operator<(const Timestamp& lhs, const Timestamp& rhs)
|
||||
{
|
||||
return lhs.GetNanos() < rhs.GetNanos();
|
||||
}
|
||||
|
||||
inline bool operator>(const Timestamp& lhs, const Timestamp& rhs)
|
||||
{
|
||||
return rhs < lhs;
|
||||
}
|
||||
|
||||
inline bool operator>=(const Timestamp& lhs, const Timestamp& rhs)
|
||||
{
|
||||
return !(lhs < rhs);
|
||||
}
|
||||
|
||||
inline bool operator<=(const Timestamp& lhs, const Timestamp& rhs)
|
||||
{
|
||||
return !(rhs < lhs);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user