summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEd Tanous <edtanous@google.com>2022-03-04 01:55:16 +0300
committerEd Tanous <edtanous@google.com>2022-03-04 01:56:29 +0300
commit46666f3fbd0414daabc65ce11421e758562156c7 (patch)
tree56bff23b99ec2be7a7acc01c075d1de37d7faa5f
parenta327dc5943ab2ae32f9d202cd77ac27d89d6a650 (diff)
downloadbmcweb-46666f3fbd0414daabc65ce11421e758562156c7.tar.xz
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
-rw-r--r--http/utility.hpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/http/utility.hpp b/http/utility.hpp
index 6c4cfb706e..32e3b28b51 100644
--- a/http/utility.hpp
+++ b/http/utility.hpp
@@ -616,12 +616,14 @@ inline std::string getDateTimeUintMs(uint64_t milliSecondsSinceEpoch)
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);