getDateTimeStdtime: fix building warnings in 32bits

Also made std::min their own lines to be more readable.

Tested: unit test passes and it builds via bitbake.

Signed-off-by: Nan Zhou <nanzhoumails@gmail.com>
Change-Id: Ic32b886cca7c2901d77b4baffd4d4a6d655e0b14
diff --git a/http/utility.hpp b/http/utility.hpp
index 5579267..62a4eb0 100644
--- a/http/utility.hpp
+++ b/http/utility.hpp
@@ -594,9 +594,8 @@
 // date. This behavior is to avoid exceptions throwed by Boost.
 inline std::string getDateTimeUint(uint64_t secondsSinceEpoch)
 {
-
-    boost::posix_time::seconds boostSeconds(
-        std::min(secondsSinceEpoch, details::maxSeconds));
+    secondsSinceEpoch = std::min(secondsSinceEpoch, details::maxSeconds);
+    boost::posix_time::seconds boostSeconds(secondsSinceEpoch);
     return details::getDateTime(
         boost::posix_time::milliseconds(boostSeconds.total_milliseconds()));
 }
@@ -607,14 +606,20 @@
 // supported date.
 inline std::string getDateTimeUintMs(uint64_t milliSecondsSinceEpoch)
 {
-    return details::getDateTime(boost::posix_time::milliseconds(
-        std::min(details::maxMilliSeconds, milliSecondsSinceEpoch)));
+    milliSecondsSinceEpoch =
+        std::min(details::maxMilliSeconds, milliSecondsSinceEpoch);
+    return details::getDateTime(
+        boost::posix_time::milliseconds(milliSecondsSinceEpoch));
 }
 
 inline std::string getDateTimeStdtime(std::time_t secondsSinceEpoch)
 {
-    boost::posix_time::ptime time = boost::posix_time::from_time_t(
-        std::min(secondsSinceEpoch, std::time_t{details::maxSeconds}));
+    if (secondsSinceEpoch > static_cast<int64_t>(details::maxSeconds))
+    {
+        secondsSinceEpoch = static_cast<std::time_t>(details::maxSeconds);
+    }
+    boost::posix_time::ptime time =
+        boost::posix_time::from_time_t(secondsSinceEpoch);
     return boost::posix_time::to_iso_extended_string(time) + "+00:00";
 }