Fix the build for time_t
Current code doesn't build because of an error injected into a patch
(ironically attempting to fix the build).
Tested: Code compiles within yocto 32 bit, and out of yocto 64 bit.
unit tests pass.
Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: Ibc4ea4617853bf717c10d812eb5d8a9352177f24
diff --git a/http/utility.hpp b/http/utility.hpp
index 6c4cfb7..32e3b28 100644
--- a/http/utility.hpp
+++ b/http/utility.hpp
@@ -616,12 +616,14 @@
inline std::string getDateTimeStdtime(std::time_t secondsSinceEpoch)
{
- constexpr static std::time_t timeTMax =
- std::numeric_limits<std::time_t>::max();
- if constexpr (std::cmp_greater(timeTMax, details::maxSeconds))
+ // secondsSinceEpoch >= maxSeconds
+ if constexpr (std::cmp_less_equal(details::maxSeconds,
+ std::numeric_limits<std::time_t>::max()))
{
- secondsSinceEpoch = std::min(static_cast<int64_t>(details::maxSeconds),
- secondsSinceEpoch);
+ if (std::cmp_greater_equal(secondsSinceEpoch, details::maxSeconds))
+ {
+ secondsSinceEpoch = details::maxSeconds;
+ }
}
boost::posix_time::ptime time =
boost::posix_time::from_time_t(secondsSinceEpoch);