diff options
author | Remko Tronçon <git@el-tramo.be> | 2010-11-24 20:33:19 (GMT) |
---|---|---|
committer | Remko Tronçon <git@el-tramo.be> | 2010-11-24 20:35:17 (GMT) |
commit | 332d60c56dfaa11fdd135088279d15cd5983b3d4 (patch) | |
tree | dd77717a4e1732da929d5ff8a0471fa3f005e201 /3rdParty/Boost/src/boost/date_time | |
parent | 90c44a10fec26d2a0935b2d62e82b6a5be028373 (diff) | |
download | swift-contrib-332d60c56dfaa11fdd135088279d15cd5983b3d4.zip swift-contrib-332d60c56dfaa11fdd135088279d15cd5983b3d4.tar.bz2 |
Upgraded Boost to 1.45.0.
Diffstat (limited to '3rdParty/Boost/src/boost/date_time')
4 files changed, 56 insertions, 17 deletions
diff --git a/3rdParty/Boost/src/boost/date_time/gregorian/conversion.hpp b/3rdParty/Boost/src/boost/date_time/gregorian/conversion.hpp index 6d4b606..c505bdd 100644 --- a/3rdParty/Boost/src/boost/date_time/gregorian/conversion.hpp +++ b/3rdParty/Boost/src/boost/date_time/gregorian/conversion.hpp @@ -6,16 +6,16 @@ * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland, Bart Garst - * $Date: 2009-06-06 07:27:35 -0400 (Sat, 06 Jun 2009) $ + * $Date: 2010-06-09 14:10:13 -0400 (Wed, 09 Jun 2010) $ */ +#include <cstring> #include <string> #include <stdexcept> #include <boost/throw_exception.hpp> #include <boost/date_time/c_time.hpp> #include <boost/date_time/special_defs.hpp> #include <boost/date_time/gregorian/gregorian_types.hpp> -#include <cstring> namespace boost { @@ -43,7 +43,7 @@ namespace gregorian { } std::tm datetm; - memset(&datetm, 0, sizeof(std::tm)); + std::memset(&datetm, 0, sizeof(datetm)); boost::gregorian::date::ymd_type ymd = d.year_month_day(); datetm.tm_year = ymd.year - 1900; datetm.tm_mon = ymd.month - 1; diff --git a/3rdParty/Boost/src/boost/date_time/microsec_time_clock.hpp b/3rdParty/Boost/src/boost/date_time/microsec_time_clock.hpp index e6f3b8e..9396579 100644 --- a/3rdParty/Boost/src/boost/date_time/microsec_time_clock.hpp +++ b/3rdParty/Boost/src/boost/date_time/microsec_time_clock.hpp @@ -6,7 +6,7 @@ * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland, Bart Garst - * $Date: 2009-06-04 07:36:43 -0400 (Thu, 04 Jun 2009) $ + * $Date: 2010-05-10 05:15:48 -0400 (Mon, 10 May 2010) $ */ @@ -98,9 +98,9 @@ namespace date_time { std::tm curr; std::tm* curr_ptr = converter(&t, &curr); - date_type d(curr_ptr->tm_year + 1900, - curr_ptr->tm_mon + 1, - curr_ptr->tm_mday); + date_type d(static_cast< typename date_type::year_type::value_type >(curr_ptr->tm_year + 1900), + static_cast< typename date_type::month_type::value_type >(curr_ptr->tm_mon + 1), + static_cast< typename date_type::day_type::value_type >(curr_ptr->tm_mday)); //The following line will adjust the fractional second tick in terms //of the current time system. For example, if the time system @@ -108,9 +108,9 @@ namespace date_time { //and all the fractional seconds return 0. int adjust = static_cast< int >(resolution_traits_type::res_adjust() / 1000000); - time_duration_type td(curr_ptr->tm_hour, - curr_ptr->tm_min, - curr_ptr->tm_sec, + time_duration_type td(static_cast< typename time_duration_type::hour_type >(curr_ptr->tm_hour), + static_cast< typename time_duration_type::min_type >(curr_ptr->tm_min), + static_cast< typename time_duration_type::sec_type >(curr_ptr->tm_sec), sub_sec * adjust); return time_type(d,td); diff --git a/3rdParty/Boost/src/boost/date_time/posix_time/conversion.hpp b/3rdParty/Boost/src/boost/date_time/posix_time/conversion.hpp index a7b1a80..3fb21d7 100644 --- a/3rdParty/Boost/src/boost/date_time/posix_time/conversion.hpp +++ b/3rdParty/Boost/src/boost/date_time/posix_time/conversion.hpp @@ -6,16 +6,16 @@ * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland, Bart Garst - * $Date: 2010-01-10 14:17:23 -0500 (Sun, 10 Jan 2010) $ + * $Date: 2010-06-09 14:10:13 -0400 (Wed, 09 Jun 2010) $ */ +#include <cstring> #include <boost/date_time/posix_time/ptime.hpp> #include <boost/date_time/posix_time/posix_time_duration.hpp> #include <boost/date_time/filetime_functions.hpp> #include <boost/date_time/c_time.hpp> #include <boost/date_time/time_resolution_traits.hpp> // absolute_value #include <boost/date_time/gregorian/conversion.hpp> -#include <cstring> namespace boost { @@ -45,7 +45,7 @@ namespace posix_time { inline std::tm to_tm(const boost::posix_time::time_duration& td) { std::tm timetm; - memset(&timetm, 0, sizeof(std::tm)); + std::memset(&timetm, 0, sizeof(timetm)); timetm.tm_hour = date_time::absolute_value(td.hours()); timetm.tm_min = date_time::absolute_value(td.minutes()); timetm.tm_sec = date_time::absolute_value(td.seconds()); diff --git a/3rdParty/Boost/src/boost/date_time/time_facet.hpp b/3rdParty/Boost/src/boost/date_time/time_facet.hpp index 3f27f77..a456db9 100644 --- a/3rdParty/Boost/src/boost/date_time/time_facet.hpp +++ b/3rdParty/Boost/src/boost/date_time/time_facet.hpp @@ -7,7 +7,7 @@ * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Martin Andrian, Jeff Garland, Bart Garst - * $Date: 2010-01-10 14:17:23 -0500 (Sun, 10 Jan 2010) $ + * $Date: 2010-06-09 12:39:31 -0400 (Wed, 09 Jun 2010) $ */ #include <cctype> @@ -21,6 +21,7 @@ #include <boost/assert.hpp> #include <boost/lexical_cast.hpp> #include <boost/throw_exception.hpp> +#include <boost/range/as_literal.hpp> #include <boost/algorithm/string/erase.hpp> #include <boost/algorithm/string/replace.hpp> #include <boost/date_time/compiler_config.hpp> @@ -42,6 +43,10 @@ namespace date_time { static const char_type seconds_format[3]; // S static const char_type hours_format[3]; // H static const char_type unrestricted_hours_format[3]; // O + static const char_type full_24_hour_time_format[3]; // T + static const char_type full_24_hour_time_expanded_format[9]; // HH:MM:SS + static const char_type short_24_hour_time_format[3]; // R + static const char_type short_24_hour_time_expanded_format[6]; // HH:MM static const char_type standard_format[9]; // x X static const char_type zone_abbrev_format[3]; // z static const char_type zone_name_format[3]; // Z @@ -73,8 +78,7 @@ namespace date_time { template <class CharT> const typename time_formats<CharT>::char_type - time_formats<CharT>::seconds_with_fractional_seconds_format[3] = - {'%','s'}; + time_formats<CharT>::seconds_with_fractional_seconds_format[3] = {'%','s'}; template <class CharT> const typename time_formats<CharT>::char_type @@ -90,6 +94,24 @@ namespace date_time { template <class CharT> const typename time_formats<CharT>::char_type + time_formats<CharT>::full_24_hour_time_format[3] = {'%','T'}; + + template <class CharT> + const typename time_formats<CharT>::char_type + time_formats<CharT>::full_24_hour_time_expanded_format[9] = + {'%','H',':','%','M',':','%','S'}; + + template <class CharT> + const typename time_formats<CharT>::char_type + time_formats<CharT>::short_24_hour_time_format[3] = {'%','R'}; + + template <class CharT> + const typename time_formats<CharT>::char_type + time_formats<CharT>::short_24_hour_time_expanded_format[6] = + {'%','H',':','%','M'}; + + template <class CharT> + const typename time_formats<CharT>::char_type //time_formats<CharT>::standard_format[5] = {'%','c',' ','%','z'}; time_formats<CharT>::standard_format[9] = {'%','x',' ','%','X',' ','%','z'}; @@ -180,6 +202,7 @@ namespace date_time { class OutItrT = std::ostreambuf_iterator<CharT, std::char_traits<CharT> > > class time_facet : public boost::date_time::date_facet<typename time_type::date_type , CharT, OutItrT> { + typedef time_formats< CharT > formats_type; public: typedef typename time_type::date_type date_type; typedef typename time_type::time_duration_type time_duration_type; @@ -266,6 +289,14 @@ namespace date_time { } string_type format(this->m_format); + // %T and %R have to be replaced here since they are not standard + boost::algorithm::replace_all(format, + boost::as_literal(formats_type::full_24_hour_time_format), + boost::as_literal(formats_type::full_24_hour_time_expanded_format)); + boost::algorithm::replace_all(format, + boost::as_literal(formats_type::short_24_hour_time_format), + boost::as_literal(formats_type::short_24_hour_time_expanded_format)); + string_type frac_str; if (format.find(seconds_with_fractional_seconds_format) != string_type::npos) { // replace %s with %S.nnn @@ -366,7 +397,7 @@ namespace date_time { } if (format.find(fractional_seconds_format) != string_type::npos) { // replace %f with nnnnnnn - if (!frac_str.size()) { + if (frac_str.empty()) { frac_str = fractional_seconds_as_string(a_time.time_of_day(), false); } boost::algorithm::replace_all(format, @@ -428,6 +459,14 @@ namespace date_time { positive_sign); } + // %T and %R have to be replaced here since they are not standard + boost::algorithm::replace_all(format, + boost::as_literal(formats_type::full_24_hour_time_format), + boost::as_literal(formats_type::full_24_hour_time_expanded_format)); + boost::algorithm::replace_all(format, + boost::as_literal(formats_type::short_24_hour_time_format), + boost::as_literal(formats_type::short_24_hour_time_expanded_format)); + /* * It is possible for a time duration to span more then 24 hours. * Standard time_put::put is obliged to behave the same as strftime |