Add operators

This commit is contained in:
2020-11-02 20:59:11 +01:00
parent 1d05f97216
commit d7f8efa5f4
2 changed files with 38 additions and 0 deletions

View File

@@ -0,0 +1,8 @@
//
// Created by georg on 6/8/23.
//
#ifndef OPENVULKANOCPP_POSE_HPP
#define OPENVULKANOCPP_POSE_HPP
#endif //OPENVULKANOCPP_POSE_HPP

View File

@@ -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);
}
}