This is an automated email from the ASF dual-hosted git repository.

jbarrett pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/geode-native.git


The following commit(s) were added to refs/heads/develop by this push:
     new 65c96cb  GEODE-3136: Fixes duration comparison bug in VS C++ runtime.
65c96cb is described below

commit 65c96cb2c7c245fdb13c130aeb06984cfcb6621d
Author: Jacob Barrett <[email protected]>
AuthorDate: Sun Nov 12 06:13:37 2017 +0000

    GEODE-3136: Fixes duration comparison bug in VS C++ runtime.
---
 cppcache/src/util/chrono/duration_bounds.hpp | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/cppcache/src/util/chrono/duration_bounds.hpp 
b/cppcache/src/util/chrono/duration_bounds.hpp
index 4fa3d51..38f2730 100644
--- a/cppcache/src/util/chrono/duration_bounds.hpp
+++ b/cppcache/src/util/chrono/duration_bounds.hpp
@@ -39,8 +39,14 @@ template <class LimitRep, class LimitPeriod,
 struct assert_bounds {
   template <class Rep, class Period>
   inline void operator()(const std::chrono::duration<Rep, Period> value) const 
{
-    constexpr auto min = std::chrono::duration<LimitRep, LimitPeriod>(lower);
-    constexpr auto max = std::chrono::duration<LimitRep, LimitPeriod>(upper);
+    /* Visual C++ library fails to account for overflow when comparing 
durations
+     * of different periods. To compensate we convert the bounds into the
+     * highest resolution duration defined in C++11.
+     */
+    constexpr std::chrono::nanoseconds min =
+        std::chrono::duration<LimitRep, LimitPeriod>(lower);
+    constexpr std::chrono::nanoseconds max =
+        std::chrono::duration<LimitRep, LimitPeriod>(upper);
     if (value > max) {
       throw IllegalArgumentException("Duration exceeds maximum of " +
                                      to_string(max));

-- 
To stop receiving notification emails like this one, please contact
['"[email protected]" <[email protected]>'].

Reply via email to