From 8a27fa9c617533e76673ce61a65e2ba869b52208 Mon Sep 17 00:00:00 2001 From: B Stack Date: Mon, 31 Aug 2020 20:07:13 -0400 Subject: add upstream 11.1 --- zen/time.h | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'zen/time.h') diff --git a/zen/time.h b/zen/time.h index d3aef36f..aaf36983 100644 --- a/zen/time.h +++ b/zen/time.h @@ -21,12 +21,9 @@ struct TimeComp //replaces std::tm and SYSTEMTIME int hour = 0; //0-23 int minute = 0; //0-59 int second = 0; //0-60 (including leap second) + + bool operator==(const TimeComp&) const = default; }; -inline bool operator==(const TimeComp& lhs, const TimeComp& rhs) -{ - return lhs.second == rhs.second && lhs.minute == rhs.minute && lhs.hour == rhs.hour && lhs.day == rhs.day && lhs.month == rhs.month && lhs.year == rhs.year; -} -inline bool operator!=(const TimeComp& lhs, const TimeComp& rhs) { return !(lhs == rhs); } TimeComp getLocalTime(time_t utc = std::time(nullptr)); //convert time_t (UTC) to local time components, returns TimeComp() on error time_t localToTimeT(const TimeComp& tc); //convert local time components to time_t (UTC), returns -1 on error @@ -199,6 +196,8 @@ TimeComp getCompileTime() } + + inline Zstring formatTime(const Zchar* format, const TimeComp& tc) { -- cgit