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