diff --git a/Builds/VisualStudio2015/RippleD.vcxproj b/Builds/VisualStudio2015/RippleD.vcxproj index 97e738b2a2..5b8eeb824a 100644 --- a/Builds/VisualStudio2015/RippleD.vcxproj +++ b/Builds/VisualStudio2015/RippleD.vcxproj @@ -86,7 +86,7 @@ - HAVE_USLEEP=1;SOCI_CXX_C11=1;_WIN32_WINNT=0x6000;-DBOOST_NO_AUTO_PTR;DEBUG;DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER;NOMINMAX;OPENSSL_NO_SSL2;WIN32_CONSOLE;_CRTDBG_MAP_ALLOC;_CRT_SECURE_NO_WARNINGS;_DEBUG;_SCL_SECURE_NO_WARNINGS;_SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS;%(PreprocessorDefinitions) + HAVE_USLEEP=1;SOCI_CXX_C11=1;_WIN32_WINNT=0x6000;BOOST_NO_AUTO_PTR;DEBUG;DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER;NOMINMAX;OPENSSL_NO_SSL2;WIN32_CONSOLE;_CRTDBG_MAP_ALLOC;_CRT_SECURE_NO_WARNINGS;_DEBUG;_SCL_SECURE_NO_WARNINGS;_SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS;%(PreprocessorDefinitions) ..\..\build\proto;..\..\src;..\..\src\beast;..\..\src\protobuf\src;..\..\src\protobuf\vsprojects;..\..\src\soci\include;..\..\src\soci\src;%(AdditionalIncludeDirectories) 4800;4244;4267;4018 Async @@ -123,7 +123,7 @@ - HAVE_USLEEP=1;SOCI_CXX_C11=1;_WIN32_WINNT=0x6000;-DBOOST_NO_AUTO_PTR;DEBUG;DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER;NOMINMAX;OPENSSL_NO_SSL2;WIN32_CONSOLE;_CRTDBG_MAP_ALLOC;_CRT_SECURE_NO_WARNINGS;_DEBUG;_SCL_SECURE_NO_WARNINGS;_SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS;%(PreprocessorDefinitions) + HAVE_USLEEP=1;SOCI_CXX_C11=1;_WIN32_WINNT=0x6000;BOOST_NO_AUTO_PTR;DEBUG;DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER;NOMINMAX;OPENSSL_NO_SSL2;WIN32_CONSOLE;_CRTDBG_MAP_ALLOC;_CRT_SECURE_NO_WARNINGS;_DEBUG;_SCL_SECURE_NO_WARNINGS;_SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS;%(PreprocessorDefinitions) ..\..\build\proto;..\..\src;..\..\src\beast;..\..\src\protobuf\src;..\..\src\protobuf\vsprojects;..\..\src\soci\include;..\..\src\soci\src;%(AdditionalIncludeDirectories) 4800;4244;4267;4018 Async @@ -160,7 +160,7 @@ - HAVE_USLEEP=1;SOCI_CXX_C11=1;_WIN32_WINNT=0x6000;-DBOOST_NO_AUTO_PTR;DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER;NDEBUG;NOMINMAX;OPENSSL_NO_SSL2;WIN32_CONSOLE;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;_SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS;%(PreprocessorDefinitions) + HAVE_USLEEP=1;SOCI_CXX_C11=1;_WIN32_WINNT=0x6000;BOOST_NO_AUTO_PTR;DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER;NDEBUG;NOMINMAX;OPENSSL_NO_SSL2;WIN32_CONSOLE;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;_SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS;%(PreprocessorDefinitions) ..\..\build\proto;..\..\src;..\..\src\beast;..\..\src\protobuf\src;..\..\src\protobuf\vsprojects;..\..\src\soci\include;..\..\src\soci\src;%(AdditionalIncludeDirectories) 4800;4244;4267;4018 Async @@ -195,7 +195,7 @@ - HAVE_USLEEP=1;SOCI_CXX_C11=1;_WIN32_WINNT=0x6000;-DBOOST_NO_AUTO_PTR;DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER;NDEBUG;NOMINMAX;OPENSSL_NO_SSL2;WIN32_CONSOLE;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;_SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS;%(PreprocessorDefinitions) + HAVE_USLEEP=1;SOCI_CXX_C11=1;_WIN32_WINNT=0x6000;BOOST_NO_AUTO_PTR;DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER;NDEBUG;NOMINMAX;OPENSSL_NO_SSL2;WIN32_CONSOLE;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;_SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS;%(PreprocessorDefinitions) ..\..\build\proto;..\..\src;..\..\src\beast;..\..\src\protobuf\src;..\..\src\protobuf\vsprojects;..\..\src\soci\include;..\..\src\soci\src;%(AdditionalIncludeDirectories) 4800;4244;4267;4018 Async @@ -282,20 +282,13 @@ True - - - - True - True - - diff --git a/Builds/VisualStudio2015/RippleD.vcxproj.filters b/Builds/VisualStudio2015/RippleD.vcxproj.filters index bdc5070e59..ad78f12115 100644 --- a/Builds/VisualStudio2015/RippleD.vcxproj.filters +++ b/Builds/VisualStudio2015/RippleD.vcxproj.filters @@ -627,24 +627,15 @@ beast\chrono - - beast\chrono - beast\chrono - - beast\chrono\impl - beast\chrono\impl beast\chrono - - beast\chrono - beast\chrono diff --git a/SConstruct b/SConstruct index b31f0628c4..f60a876c47 100644 --- a/SConstruct +++ b/SConstruct @@ -359,7 +359,7 @@ def config_base(env): ,{'HAVE_USLEEP' : '1'} ,{'SOCI_CXX_C11' : '1'} ,'_SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS' - ,'-DBOOST_NO_AUTO_PTR' + ,'BOOST_NO_AUTO_PTR' ]) if Beast.system.windows: diff --git a/src/beast/beast/Chrono.h b/src/beast/beast/Chrono.h index 6aea7d82a6..390ee11261 100644 --- a/src/beast/beast/Chrono.h +++ b/src/beast/beast/Chrono.h @@ -22,7 +22,6 @@ #include #include -#include #include #include #include diff --git a/src/beast/beast/chrono/Chrono.unity.cpp b/src/beast/beast/chrono/Chrono.unity.cpp index 0dcc37d3e8..10460203fc 100644 --- a/src/beast/beast/chrono/Chrono.unity.cpp +++ b/src/beast/beast/chrono/Chrono.unity.cpp @@ -23,7 +23,6 @@ #include -#include #include #include diff --git a/src/beast/beast/chrono/basic_seconds_clock.h b/src/beast/beast/chrono/basic_seconds_clock.h index 6247935b61..8dbc47aec9 100644 --- a/src/beast/beast/chrono/basic_seconds_clock.h +++ b/src/beast/beast/chrono/basic_seconds_clock.h @@ -107,6 +107,7 @@ public: for (auto iter : workers_) iter->sample(); + using namespace std::chrono; clock_type::time_point const when ( floor ( clock_type::now().time_since_epoch()) + diff --git a/src/beast/beast/chrono/chrono_io.h b/src/beast/beast/chrono/chrono_io.h deleted file mode 100644 index b9dfacdfbe..0000000000 --- a/src/beast/beast/chrono/chrono_io.h +++ /dev/null @@ -1,803 +0,0 @@ -//------------------------------------------------------------------------------ -/* - This file is part of Beast: https://github.com/vinniefalco/Beast - Copyright 2013, Vinnie Falco - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ -//============================================================================== - -// chrono_io -// -// (C) Copyright Howard Hinnant -// Use, modification and distribution are subject to the Boost Software License, -// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt). - -#ifndef BEAST_CHRONO_CHRONO_IO_H_INCLUDED -#define BEAST_CHRONO_CHRONO_IO_H_INCLUDED - -#include - -#include -#include - -/* - - chrono_io synopsis - -#include -#include - -namespace std -{ -namespace chrono -{ - -enum duration_style {prefix, symbol}; -enum timezone {utc, local}; - -// facets - -class durationpunct - : public locale::facet -{ -public: - static locale::id id; - - explicit durationpunct(size_t refs = 0); - explicit durationpunct(duration_style fmt, size_t refs = 0); - - bool is_symbol_name() const noexcept; - bool is_prefix_name() const noexcept; -}; - -template -class timepunct - : public locale::facet -{ -public: - typedef basic_string string_type; - - static locale::id id; - - explicit timepunct(size_t refs = 0); - timepunct(timezone tz, string_type fmt, size_t refs = 0); - - const string_type& fmt() const noexcept; - std::chrono::timezone timezone() const noexcept; -}; - -// manipulators - -class duration_fmt -{ -public: - explicit duration_fmt(duration_style f) noexcept; - explicit operator duration_style() const noexcept; -}; - -unspecified time_fmt(timezone tz); -template - unspecified time_fmt(timezone tz, basic_string fmt); -template - unspecified time_fmt(timezone tz, const charT* fmt); - -template -std::basic_ostream& -operator<<(std::basic_ostream& os, duration_fmt d); - -template -std::basic_istream& -operator>>(std::basic_istream& is, duration_fmt d); - -// duration I/O - -template - basic_ostream& - operator<<(basic_ostream& os, const duration& d); - -template - basic_istream& - operator>>(basic_istream& is, duration& d); - -// system_clock I/O - -template - basic_ostream& - operator<<(basic_ostream& os, - const time_point& tp); - -template - basic_istream& - operator>>(basic_istream& is, - time_point& tp); - -// steady_clock I/O - -template - basic_ostream& - operator<<(basic_ostream& os, - const time_point& tp); - -template - basic_istream& - operator>>(basic_istream& is, - time_point& tp); - -// high_resolution_clock I/O - -template - basic_ostream& - operator<<(basic_ostream& os, - const time_point& tp); - -template - basic_istream& - operator>>(basic_istream& is, - time_point& tp); - -} // chrono -} // std - -*/ - -#include -#include - -//_LIBCPP_BEGIN_NAMESPACE_STD -namespace std { - -namespace chrono -{ - -template -To -round(const duration& d) -{ - To t0 = duration_cast(d); - To t1 = t0; - ++t1; - typedef typename common_type >::type _D; - _D diff0 = d - t0; - _D diff1 = t1 - d; - if (diff0 == diff1) - { - if (t0.count() & 1) - return t1; - return t0; - } - else if (diff0 < diff1) - return t0; - return t1; -} - -enum duration_style {prefix, symbol}; -enum timezone {utc, local}; - -class durationpunct - : public locale::facet -{ -private: - duration_style __style_; -public: - static locale::id id; - - explicit durationpunct(size_t refs = 0) - : locale::facet(refs), __style_(prefix) {} - - explicit durationpunct(duration_style fmt, size_t refs = 0) - : locale::facet(refs), __style_(fmt) {} - - bool is_symbol_name() const noexcept {return __style_ == symbol;} - bool is_prefix_name() const noexcept {return __style_ == prefix;} -}; - -class duration_fmt -{ - duration_style form_; -public: - explicit duration_fmt(duration_style f) noexcept : form_(f) {} - // VFALCO NOTE disabled this for MSVC - /*explicit*/ - operator duration_style() const noexcept {return form_;} -}; - -template -basic_ostream& -operator <<(basic_ostream& os, duration_fmt d) -{ - os.imbue(locale(os.getloc(), new durationpunct(static_cast(d)))); - return os; -} - -template -basic_istream& -operator >>(basic_istream& is, duration_fmt d) -{ - is.imbue(locale(is.getloc(), new durationpunct(static_cast(d)))); - return is; -} - -template -basic_string<_CharT> -__get_unit(bool __is_long, const duration<_Rep, _Period>& d) -{ - if (__is_long) - { - _CharT __p[] = {'s', 'e', 'c', 'o', 'n', 'd', 's', 0}; - basic_string<_CharT> s = ratio_string<_Period, _CharT>::prefix() + __p; - if (d.count() == 1 || d.count() == -1) - s.pop_back(); - return s; - } - return ratio_string<_Period, _CharT>::symbol() + 's'; -} - -template -basic_string<_CharT> -__get_unit(bool __is_long, const duration<_Rep, ratio<1> >& d) -{ - if (__is_long) - { - _CharT __p[] = {'s', 'e', 'c', 'o', 'n', 'd', 's'}; - basic_string<_CharT> s = basic_string<_CharT>(__p, __p + sizeof(__p) / sizeof(_CharT)); - if (d.count() == 1 || d.count() == -1) - s.pop_back(); - return s; - } - return basic_string<_CharT>(1, 's'); -} - -template -basic_string<_CharT> -__get_unit(bool __is_long, const duration<_Rep, ratio<60> >& d) -{ - if (__is_long) - { - _CharT __p[] = {'m', 'i', 'n', 'u', 't', 'e', 's'}; - basic_string<_CharT> s = basic_string<_CharT>(__p, __p + sizeof(__p) / sizeof(_CharT)); - if (d.count() == 1 || d.count() == -1) - s.pop_back(); - return s; - } - _CharT __p[] = {'m', 'i', 'n'}; - return basic_string<_CharT>(__p, __p + sizeof(__p) / sizeof(_CharT)); -} - -template -basic_string<_CharT> -__get_unit(bool __is_long, const duration<_Rep, ratio<3600> >& d) -{ - if (__is_long) - { - _CharT __p[] = {'h', 'o', 'u', 'r', 's'}; - basic_string<_CharT> s = basic_string<_CharT>(__p, __p + sizeof(__p) / sizeof(_CharT)); - if (d.count() == 1 || d.count() == -1) - s.pop_back(); - return s; - } - return basic_string<_CharT>(1, 'h'); -} - -template -basic_ostream<_CharT, _Traits>& -operator<<(basic_ostream<_CharT, _Traits>& __os, const duration<_Rep, _Period>& __d) -{ - typename basic_ostream<_CharT, _Traits>::sentry ok(__os); - if (ok) - { - typedef durationpunct _F; - typedef basic_string<_CharT> string_type; - bool failed = false; - try - { - bool __is_long = true; - locale __loc = __os.getloc(); - if (has_facet<_F>(__loc)) - { - const _F& f = use_facet<_F>(__loc); - __is_long = f.is_prefix_name(); - } - string_type __unit = __get_unit<_CharT>(__is_long, __d); - __os << __d.count() << ' ' << __unit; - } - catch (...) - { - failed = true; - } - if (failed) - __os.setstate(ios_base::failbit | ios_base::badbit); - } - return __os; -} - -template ::value> -struct __duration_io_intermediate -{ - typedef _Rep type; -}; - -template -struct __duration_io_intermediate<_Rep, true> -{ - typedef typename conditional - < - is_floating_point<_Rep>::value, - long double, - typename conditional - < - is_signed<_Rep>::value, - long long, - unsigned long long - >::type - >::type type; -}; - -template -T -__gcd(T x, T y) -{ - while (y != 0) - { - T old_x = x; - x = y; - y = old_x % y; - } - return x; -} - -template <> -long double -inline -__gcd(long double, long double) -{ - return 1; -} - -template -basic_istream<_CharT, _Traits>& -operator>>(basic_istream<_CharT, _Traits>& __is, duration<_Rep, _Period>& __d) -{ - // These are unused and generate warnings - //typedef basic_string<_CharT> string_type; - //typedef durationpunct _F; - - typedef typename __duration_io_intermediate<_Rep>::type _IR; - _IR __r; - // read value into __r - __is >> __r; - if (__is.good()) - { - // now determine unit - typedef istreambuf_iterator<_CharT, _Traits> _I; - _I __i(__is); - _I __e; - if (__i != __e && *__i == ' ') // mandatory ' ' after value - { - ++__i; - if (__i != __e) - { - locale __loc = __is.getloc(); - // unit is num / den (yet to be determined) - unsigned long long num = 0; - unsigned long long den = 0; - ios_base::iostate __err = ios_base::goodbit; - if (*__i == '[') - { - // parse [N/D]s or [N/D]seconds format - ++__i; - _CharT __x; - __is >> num >> __x >> den; - if (!__is.good() || __x != '/') - { - __is.setstate(__is.failbit); - return __is; - } - __i = _I(__is); - if (*__i != ']') - { - __is.setstate(__is.failbit); - return __is; - } - ++__i; - const basic_string<_CharT> __units[] = - { - __get_unit<_CharT>(true, seconds(2)), - __get_unit<_CharT>(true, seconds(1)), - __get_unit<_CharT>(false, seconds(1)) - }; - const basic_string<_CharT>* __k = __scan_keyword(__i, __e, - __units, __units + sizeof(__units)/sizeof(__units[0]), - use_facet >(__loc), - __err); - switch ((__k - __units) / 3) - { - case 0: - break; - default: - __is.setstate(__err); - return __is; - } - } - else - { - // parse SI name, short or long - const basic_string<_CharT> __units[] = - { - __get_unit<_CharT>(true, duration<_Rep, atto>(2)), - __get_unit<_CharT>(true, duration<_Rep, atto>(1)), - __get_unit<_CharT>(false, duration<_Rep, atto>(1)), - __get_unit<_CharT>(true, duration<_Rep, femto>(2)), - __get_unit<_CharT>(true, duration<_Rep, femto>(1)), - __get_unit<_CharT>(false, duration<_Rep, femto>(1)), - __get_unit<_CharT>(true, duration<_Rep, pico>(2)), - __get_unit<_CharT>(true, duration<_Rep, pico>(1)), - __get_unit<_CharT>(false, duration<_Rep, pico>(1)), - __get_unit<_CharT>(true, duration<_Rep, nano>(2)), - __get_unit<_CharT>(true, duration<_Rep, nano>(1)), - __get_unit<_CharT>(false, duration<_Rep, nano>(1)), - __get_unit<_CharT>(true, duration<_Rep, micro>(2)), - __get_unit<_CharT>(true, duration<_Rep, micro>(1)), - __get_unit<_CharT>(false, duration<_Rep, micro>(1)), - __get_unit<_CharT>(true, duration<_Rep, milli>(2)), - __get_unit<_CharT>(true, duration<_Rep, milli>(1)), - __get_unit<_CharT>(false, duration<_Rep, milli>(1)), - __get_unit<_CharT>(true, duration<_Rep, centi>(2)), - __get_unit<_CharT>(true, duration<_Rep, centi>(1)), - __get_unit<_CharT>(false, duration<_Rep, centi>(1)), - __get_unit<_CharT>(true, duration<_Rep, deci>(2)), - __get_unit<_CharT>(true, duration<_Rep, deci>(1)), - __get_unit<_CharT>(false, duration<_Rep, deci>(1)), - __get_unit<_CharT>(true, duration<_Rep, deca>(2)), - __get_unit<_CharT>(true, duration<_Rep, deca>(1)), - __get_unit<_CharT>(false, duration<_Rep, deca>(1)), - __get_unit<_CharT>(true, duration<_Rep, hecto>(2)), - __get_unit<_CharT>(true, duration<_Rep, hecto>(1)), - __get_unit<_CharT>(false, duration<_Rep, hecto>(1)), - __get_unit<_CharT>(true, duration<_Rep, kilo>(2)), - __get_unit<_CharT>(true, duration<_Rep, kilo>(1)), - __get_unit<_CharT>(false, duration<_Rep, kilo>(1)), - __get_unit<_CharT>(true, duration<_Rep, mega>(2)), - __get_unit<_CharT>(true, duration<_Rep, mega>(1)), - __get_unit<_CharT>(false, duration<_Rep, mega>(1)), - __get_unit<_CharT>(true, duration<_Rep, giga>(2)), - __get_unit<_CharT>(true, duration<_Rep, giga>(1)), - __get_unit<_CharT>(false, duration<_Rep, giga>(1)), - __get_unit<_CharT>(true, duration<_Rep, tera>(2)), - __get_unit<_CharT>(true, duration<_Rep, tera>(1)), - __get_unit<_CharT>(false, duration<_Rep, tera>(1)), - __get_unit<_CharT>(true, duration<_Rep, peta>(2)), - __get_unit<_CharT>(true, duration<_Rep, peta>(1)), - __get_unit<_CharT>(false, duration<_Rep, peta>(1)), - __get_unit<_CharT>(true, duration<_Rep, exa>(2)), - __get_unit<_CharT>(true, duration<_Rep, exa>(1)), - __get_unit<_CharT>(false, duration<_Rep, exa>(1)), - __get_unit<_CharT>(true, duration<_Rep, ratio<1> >(2)), - __get_unit<_CharT>(true, duration<_Rep, ratio<1> >(1)), - __get_unit<_CharT>(false, duration<_Rep, ratio<1> >(1)), - __get_unit<_CharT>(true, duration<_Rep, ratio<60> >(2)), - __get_unit<_CharT>(true, duration<_Rep, ratio<60> >(1)), - __get_unit<_CharT>(false, duration<_Rep, ratio<60> >(1)), - __get_unit<_CharT>(true, duration<_Rep, ratio<3600> >(2)), - __get_unit<_CharT>(true, duration<_Rep, ratio<3600> >(1)), - __get_unit<_CharT>(false, duration<_Rep, ratio<3600> >(1)) - }; - const basic_string<_CharT>* __k = __scan_keyword(__i, __e, - __units, __units + sizeof(__units)/sizeof(__units[0]), - use_facet >(__loc), - __err); - switch (__k - __units) - { - case 0: - case 1: - case 2: - num = 1ULL; - den = 1000000000000000000ULL; - break; - case 3: - case 4: - case 5: - num = 1ULL; - den = 1000000000000000ULL; - break; - case 6: - case 7: - case 8: - num = 1ULL; - den = 1000000000000ULL; - break; - case 9: - case 10: - case 11: - num = 1ULL; - den = 1000000000ULL; - break; - case 12: - case 13: - case 14: - num = 1ULL; - den = 1000000ULL; - break; - case 15: - case 16: - case 17: - num = 1ULL; - den = 1000ULL; - break; - case 18: - case 19: - case 20: - num = 1ULL; - den = 100ULL; - break; - case 21: - case 22: - case 23: - num = 1ULL; - den = 10ULL; - break; - case 24: - case 25: - case 26: - num = 10ULL; - den = 1ULL; - break; - case 27: - case 28: - case 29: - num = 100ULL; - den = 1ULL; - break; - case 30: - case 31: - case 32: - num = 1000ULL; - den = 1ULL; - break; - case 33: - case 34: - case 35: - num = 1000000ULL; - den = 1ULL; - break; - case 36: - case 37: - case 38: - num = 1000000000ULL; - den = 1ULL; - break; - case 39: - case 40: - case 41: - num = 1000000000000ULL; - den = 1ULL; - break; - case 42: - case 43: - case 44: - num = 1000000000000000ULL; - den = 1ULL; - break; - case 45: - case 46: - case 47: - num = 1000000000000000000ULL; - den = 1ULL; - break; - case 48: - case 49: - case 50: - num = 1; - den = 1; - break; - case 51: - case 52: - case 53: - num = 60; - den = 1; - break; - case 54: - case 55: - case 56: - num = 3600; - den = 1; - break; - default: - __is.setstate(__err); - return __is; - } - } - // unit is num/den - // __r should be multiplied by (num/den) / _Period - // Reduce (num/den) / _Period to lowest terms - unsigned long long __gcd_n1_n2 = __gcd(num, _Period::num); - unsigned long long __gcd_d1_d2 = __gcd(den, _Period::den); - num /= __gcd_n1_n2; - den /= __gcd_d1_d2; - unsigned long long __n2 = _Period::num / __gcd_n1_n2; - unsigned long long __d2 = _Period::den / __gcd_d1_d2; - if (num > numeric_limits::max() / __d2 || - den > numeric_limits::max() / __n2) - { - // (num/den) / _Period overflows - __is.setstate(__is.failbit); - return __is; - } - num *= __d2; - den *= __n2; - // num / den is now factor to multiply by __r - typedef typename common_type<_IR, unsigned long long>::type _CT; - if (is_integral<_IR>::value) - { - // Reduce __r * num / den - _CT __t = __gcd<_CT>(__r, den); - __r /= __t; - den /= __t; - if (den != 1) - { - // Conversion to _Period is integral and not exact - __is.setstate(__is.failbit); - return __is; - } - } - if (__r > duration_values<_CT>::max() / num) - { - // Conversion to _Period overflowed - __is.setstate(__is.failbit); - return __is; - } - _CT __t = __r * num; - __t /= den; - if (duration_values<_Rep>::max() < __t) - { - // Conversion to _Period overflowed - __is.setstate(__is.failbit); - return __is; - } - // Success! Store it. - __r = _Rep(__t); - __d = duration<_Rep, _Period>(__r); - __is.setstate(__err); - } - else - __is.setstate(__is.failbit | __is.eofbit); - } - else - { - if (__i == __e) - __is.setstate(__is.eofbit); - __is.setstate(__is.failbit); - } - } - else - __is.setstate(__is.failbit); - return __is; -} - -template -class timepunct - : public locale::facet -{ -public: - typedef basic_string string_type; - -private: - string_type fmt_; - chrono::timezone tz_; - -public: - static locale::id id; - - explicit timepunct(size_t refs = 0) - : locale::facet(refs), tz_(utc) {} - timepunct(timezone tz, string_type fmt, size_t refs = 0) - : locale::facet(refs), fmt_(std::move(fmt)), tz_(tz) {} - - const string_type& fmt() const noexcept {return fmt_;} - chrono::timezone get_timezone() const noexcept {return tz_;} -}; - -template -locale::id -timepunct::id; - -template -basic_ostream<_CharT, _Traits>& -operator<<(basic_ostream<_CharT, _Traits>& __os, - const time_point& __tp) -{ - return __os << __tp.time_since_epoch() << " since boot"; -} - -template -struct __time_manip -{ - basic_string fmt_; - timezone tz_; - - __time_manip(timezone tz, basic_string fmt) - : fmt_(std::move(fmt)), - tz_(tz) {} -}; - -template -basic_ostream& -operator <<(basic_ostream& os, __time_manip m) -{ - os.imbue(locale(os.getloc(), new timepunct(m.tz_, std::move(m.fmt_)))); - return os; -} - -template -basic_istream& -operator >>(basic_istream& is, __time_manip m) -{ - is.imbue(locale(is.getloc(), new timepunct(m.tz_, std::move(m.fmt_)))); - return is; -} - -template -inline -__time_manip -time_fmt(timezone tz, const charT* fmt) -{ - return __time_manip(tz, fmt); -} - -template -inline -__time_manip -time_fmt(timezone tz, basic_string fmt) -{ - return __time_manip(tz, std::move(fmt)); -} - -class __time_man -{ - timezone form_; -public: - explicit __time_man(timezone f) : form_(f) {} - // explicit - operator timezone() const {return form_;} -}; - -template -basic_ostream& -operator <<(basic_ostream& os, __time_man m) -{ - os.imbue(locale(os.getloc(), new timepunct(static_cast(m), basic_string()))); - return os; -} - -template -basic_istream& -operator >>(basic_istream& is, __time_man m) -{ - is.imbue(locale(is.getloc(), new timepunct(static_cast(m), basic_string()))); - return is; -} - -inline -__time_man -time_fmt(timezone f) -{ - return __time_man(f); -} - -} // chrono - -} - -#endif - diff --git a/src/beast/beast/chrono/chrono_util.h b/src/beast/beast/chrono/chrono_util.h index 30d8411cfb..1adc676a4c 100644 --- a/src/beast/beast/chrono/chrono_util.h +++ b/src/beast/beast/chrono/chrono_util.h @@ -23,6 +23,7 @@ // From Howard Hinnant // http://home.roadrunner.com/~hinnant/duration_io/chrono_util.html +#if !defined(_MSC_FULL_VER) || (_MSC_FULL_VER <= 190023506) // round down template To floor(std::chrono::duration const& d) @@ -62,5 +63,6 @@ To ceil (std::chrono::duration const& d) ++t; return t; } +#endif #endif diff --git a/src/beast/beast/chrono/impl/chrono_io.cpp b/src/beast/beast/chrono/impl/chrono_io.cpp deleted file mode 100644 index 6be9104708..0000000000 --- a/src/beast/beast/chrono/impl/chrono_io.cpp +++ /dev/null @@ -1,41 +0,0 @@ -//------------------------------------------------------------------------------ -/* - This file is part of Beast: https://github.com/vinniefalco/Beast - Copyright 2013, Vinnie Falco - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ -//============================================================================== - -// chrono_io -// -// (C) Copyright Howard Hinnant -// Use, modification and distribution are subject to the Boost Software License, -// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt). - -#include - -//_LIBCPP_BEGIN_NAMESPACE_STD -namespace std { - -namespace chrono -{ - -locale::id -durationpunct::id; - -} // chrono - -//_LIBCPP_END_NAMESPACE_STD -} diff --git a/src/beast/beast/chrono/tests/abstract_clock.test.cpp b/src/beast/beast/chrono/tests/abstract_clock.test.cpp index 316147ba72..b508d0ed03 100644 --- a/src/beast/beast/chrono/tests/abstract_clock.test.cpp +++ b/src/beast/beast/chrono/tests/abstract_clock.test.cpp @@ -42,9 +42,9 @@ public: std::stringstream ss; ss << - "t1= " << t1.time_since_epoch() << - ", t2= " << t2.time_since_epoch() << - ", elapsed= " << (t2 - t1); + "t1= " << t1.time_since_epoch().count() << + ", t2= " << t2.time_since_epoch().count() << + ", elapsed= " << (t2 - t1).count(); log << ss.str(); } } @@ -56,13 +56,13 @@ public: std::stringstream ss; - ss << "now() = " << c.now().time_since_epoch() << std::endl; + ss << "now() = " << c.now().time_since_epoch().count() << std::endl; c.set (clock_type::time_point (std::chrono::seconds(1))); - ss << "now() = " << c.now().time_since_epoch() << std::endl; + ss << "now() = " << c.now().time_since_epoch().count() << std::endl; c.set (clock_type::time_point (std::chrono::seconds(2))); - ss << "now() = " << c.now().time_since_epoch() << std::endl; + ss << "now() = " << c.now().time_since_epoch().count() << std::endl; log << ss.str(); } diff --git a/src/beast/beast/hash/tests/hash_append_test.cpp b/src/beast/beast/hash/tests/hash_append_test.cpp index e8b656b2bc..ed9a002411 100644 --- a/src/beast/beast/hash/tests/hash_append_test.cpp +++ b/src/beast/beast/hash/tests/hash_append_test.cpp @@ -24,7 +24,6 @@ #include #include #include -#include #include #include #include diff --git a/src/beast/beast/hash/tests/hash_metrics.h b/src/beast/beast/hash/tests/hash_metrics.h index 3d42747c90..088cef3d63 100644 --- a/src/beast/beast/hash/tests/hash_metrics.h +++ b/src/beast/beast/hash/tests/hash_metrics.h @@ -166,15 +166,15 @@ windowed_score (FwdIter first, FwdIter last) int maxwidth = 20; // We need at least 5 keys per bin to reliably test distribution biases // down to 1%, so don't bother to test sparser distributions than that - while (static_cast(size) / (1 << maxwidth) < 5.0) + while (static_cast(size) / (1ull << maxwidth) < 5.0) maxwidth--; double worst = 0; - std::vector bins (1 << maxwidth); + std::vector bins (1ull << maxwidth); int const hashbits = sizeof(std::size_t) * CHAR_BIT; for (int start = 0; start < hashbits; ++start) { int width = maxwidth; - bins.assign (1 << width, 0); + bins.assign (1ull << width, 0); for (auto iter (first); iter != last; ++iter) ++bins[detail::window(&*iter, start, width)]; // Test the distribution, then fold the bins in half, diff --git a/src/beast/beast/hash/tests/hash_speed_test.cpp b/src/beast/beast/hash/tests/hash_speed_test.cpp index 36c9e3ff5f..26439479ec 100644 --- a/src/beast/beast/hash/tests/hash_speed_test.cpp +++ b/src/beast/beast/hash/tests/hash_speed_test.cpp @@ -23,7 +23,6 @@ #include #include #include -#include #include #include #include @@ -61,7 +60,7 @@ public: } auto const elapsed = clock_type::now() - start; log << setw(12) << what << " " << - duration(elapsed) << "s"; + duration(elapsed).count() << "s"; } void diff --git a/src/beast/beast/insight/Event.h b/src/beast/beast/insight/Event.h index 0e41ded8a8..73c65718ff 100644 --- a/src/beast/beast/insight/Event.h +++ b/src/beast/beast/insight/Event.h @@ -65,6 +65,7 @@ public: void notify (std::chrono::duration const& value) const { + using namespace std::chrono; if (m_impl) m_impl->notify (ceil (value)); } diff --git a/src/ripple/app/ledger/impl/LedgerConsensusImp.cpp b/src/ripple/app/ledger/impl/LedgerConsensusImp.cpp index 2e6e410b63..ff9a00dc96 100644 --- a/src/ripple/app/ledger/impl/LedgerConsensusImp.cpp +++ b/src/ripple/app/ledger/impl/LedgerConsensusImp.cpp @@ -184,7 +184,7 @@ checkConsensus ( "checkConsensus: prop=" << currentProposers << "/" << previousProposers << " agree=" << currentAgree << " validated=" << currentFinished << - " time=" << currentAgreeTime << "/" << previousAgreeTime; + " time=" << currentAgreeTime.count() << "/" << previousAgreeTime.count(); if (currentAgreeTime <= LEDGER_MIN_CONSENSUS) return ConsensusState::No; diff --git a/src/ripple/app/main/Application.cpp b/src/ripple/app/main/Application.cpp index d68cdb278d..1ecd617ba6 100644 --- a/src/ripple/app/main/Application.cpp +++ b/src/ripple/app/main/Application.cpp @@ -272,6 +272,7 @@ private: template void operator() (Duration const& elapsed) { + using namespace std::chrono; auto const ms (ceil (elapsed)); { @@ -284,7 +285,7 @@ private: if (ms.count() >= 500) { JLOG(m_journal.warning) << - "io_service latency = " << ms; + "io_service latency = " << ms.count(); } } diff --git a/src/ripple/basics/KeyCache.h b/src/ripple/basics/KeyCache.h index 4aa454c9d4..da4eeccbac 100644 --- a/src/ripple/basics/KeyCache.h +++ b/src/ripple/basics/KeyCache.h @@ -23,7 +23,6 @@ #include #include #include -#include #include #include diff --git a/src/ripple/basics/TaggedCache.h b/src/ripple/basics/TaggedCache.h index 7971afb2e0..3d6e1ab120 100644 --- a/src/ripple/basics/TaggedCache.h +++ b/src/ripple/basics/TaggedCache.h @@ -23,7 +23,6 @@ #include #include #include -#include #include #include #include @@ -124,7 +123,7 @@ public: lock_guard lock (m_mutex); m_target_age = std::chrono::seconds (s); if (m_journal.debug) m_journal.debug << - m_name << " target age set to " << m_target_age; + m_name << " target age set to " << m_target_age.count(); } int getCacheSize () const @@ -194,7 +193,7 @@ public: if (m_journal.trace) m_journal.trace << m_name << " is growing fast " << m_cache.size () << " of " << m_target_size << - " aging at " << (now - when_expire) << " of " << m_target_age; + " aging at " << (now - when_expire).count() << " of " << m_target_age.count(); } stuffToSweep.reserve (m_cache.size ()); diff --git a/src/ripple/core/impl/JobQueue.cpp b/src/ripple/core/impl/JobQueue.cpp index a20feb6f08..61d74e583c 100644 --- a/src/ripple/core/impl/JobQueue.cpp +++ b/src/ripple/core/impl/JobQueue.cpp @@ -436,6 +436,7 @@ template void JobQueue::on_dequeue (JobType type, std::chrono::duration const& value) { + using namespace std::chrono; auto const ms (ceil (value)); if (ms.count() >= 10) @@ -446,6 +447,7 @@ template void JobQueue::on_execute (JobType type, std::chrono::duration const& value) { + using namespace std::chrono; auto const ms (ceil (value)); if (ms.count() >= 10) diff --git a/src/ripple/nodestore/tests/import_test.cpp b/src/ripple/nodestore/tests/import_test.cpp index e03cc02a86..2235ed85da 100644 --- a/src/ripple/nodestore/tests/import_test.cpp +++ b/src/ripple/nodestore/tests/import_test.cpp @@ -22,7 +22,6 @@ #include #include #include -#include #include #include #include @@ -105,7 +104,7 @@ pretty_time(std::ostream& os, std::chrono::duration d) else { // use integral - os << std::chrono::round(d).count(); + os << round(d).count(); } os << "ns"; } @@ -121,7 +120,7 @@ pretty_time(std::ostream& os, std::chrono::duration d) else { // use integral - os << std::chrono::round(d).count(); + os << round(d).count(); } os << "us"; } @@ -137,7 +136,7 @@ pretty_time(std::ostream& os, std::chrono::duration d) else { // use integral - os << std::chrono::round(d).count(); + os << round(d).count(); } os << "ms"; } @@ -153,7 +152,7 @@ pretty_time(std::ostream& os, std::chrono::duration d) else { // use integral - os << std::chrono::round(d).count(); + os << round(d).count(); } os << "s"; } @@ -169,7 +168,7 @@ pretty_time(std::ostream& os, std::chrono::duration d) else { // use integral - os << std::chrono::round(d).count(); + os << round(d).count(); } os << "min"; } diff --git a/src/ripple/peerfinder/impl/Livecache.h b/src/ripple/peerfinder/impl/Livecache.h index 90fd01fb7b..9e77c3066d 100644 --- a/src/ripple/peerfinder/impl/Livecache.h +++ b/src/ripple/peerfinder/impl/Livecache.h @@ -23,7 +23,6 @@ #include #include #include -#include #include #include #include @@ -477,7 +476,7 @@ Livecache ::onWrite (beast::PropertyStream::Map& map) item ["hops"] = e.endpoint.hops; item ["address"] = e.endpoint.address.to_string (); std::stringstream ss; - ss << iter.when() - expired; + ss << (iter.when() - expired).count(); item ["expires"] = ss.str(); } } diff --git a/src/ripple/protocol/tests/digest_test.cpp b/src/ripple/protocol/tests/digest_test.cpp index 3ff42ba6cb..747084dfab 100644 --- a/src/ripple/protocol/tests/digest_test.cpp +++ b/src/ripple/protocol/tests/digest_test.cpp @@ -19,7 +19,6 @@ #include #include -#include #include #include #include diff --git a/src/ripple/resource/tests/Logic.test.cpp b/src/ripple/resource/tests/Logic.test.cpp index 5e7f9e95dd..9c1c3170c4 100644 --- a/src/ripple/resource/tests/Logic.test.cpp +++ b/src/ripple/resource/tests/Logic.test.cpp @@ -21,7 +21,6 @@ #include #include #include -#include #include namespace ripple { @@ -214,7 +213,7 @@ public: for (int i = 0; i < 128; ++i) { j.info << - "Time= " << logic.clock().now().time_since_epoch() << + "Time= " << logic.clock().now().time_since_epoch().count() << ", Balance = " << c.balance(); logic.advance(); } @@ -230,7 +229,7 @@ public: { c.charge (fee); j.info << - "Time= " << logic.clock().now().time_since_epoch() << + "Time= " << logic.clock().now().time_since_epoch().count() << ", Balance = " << c.balance(); logic.advance(); } diff --git a/src/ripple/server/impl/ServerImpl.cpp b/src/ripple/server/impl/ServerImpl.cpp index 9a88c1e875..326c68d53d 100644 --- a/src/ripple/server/impl/ServerImpl.cpp +++ b/src/ripple/server/impl/ServerImpl.cpp @@ -21,7 +21,6 @@ #include #include #include -#include #include #include #include