diff options
author | Remko Tronçon <git@el-tramo.be> | 2010-04-11 18:19:17 (GMT) |
---|---|---|
committer | Remko Tronçon <git@el-tramo.be> | 2010-04-11 19:20:07 (GMT) |
commit | 857e44c156a1dbefcb49bb5792c4384cebd8762a (patch) | |
tree | 11947fb81ad9c502627f1b2bb8f090fb8d53c107 /3rdParty/Boost/src/boost/date_time/posix_time | |
parent | 77d4eb7588e113beaa03f3347523b26adefdeb06 (diff) | |
download | swift-857e44c156a1dbefcb49bb5792c4384cebd8762a.zip swift-857e44c156a1dbefcb49bb5792c4384cebd8762a.tar.bz2 |
Updated Boost to 1.42.
Diffstat (limited to '3rdParty/Boost/src/boost/date_time/posix_time')
4 files changed, 107 insertions, 111 deletions
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 82f8dca..9cdb864 100644 --- a/3rdParty/Boost/src/boost/date_time/posix_time/conversion.hpp +++ b/3rdParty/Boost/src/boost/date_time/posix_time/conversion.hpp @@ -2,18 +2,19 @@ #define POSIX_TIME_CONVERSION_HPP___ /* Copyright (c) 2002-2005 CrystalClear Software, Inc. - * Use, modification and distribution is subject to the + * Use, modification and distribution is subject to the * 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: 2008-11-12 14:37:53 -0500 (Wed, 12 Nov 2008) $ + * $Date: 2010-01-10 14:17:23 -0500 (Sun, 10 Jan 2010) $ */ -#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/gregorian/conversion.hpp" +#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> namespace boost { @@ -22,34 +23,28 @@ namespace posix_time { //! Function that converts a time_t into a ptime. inline - ptime from_time_t(std::time_t t) + ptime from_time_t(std::time_t t) { ptime start(gregorian::date(1970,1,1)); return start + seconds(static_cast<long>(t)); } - //! Convert a time to a tm structure truncating any fractional seconds + //! Convert a time to a tm structure truncating any fractional seconds inline std::tm to_tm(const boost::posix_time::ptime& t) { std::tm timetm = boost::gregorian::to_tm(t.date()); boost::posix_time::time_duration td = t.time_of_day(); - timetm.tm_hour = td.hours(); - timetm.tm_min = td.minutes(); + timetm.tm_hour = td.hours(); + timetm.tm_min = td.minutes(); timetm.tm_sec = td.seconds(); - timetm.tm_isdst = -1; // -1 used when dst info is unknown + timetm.tm_isdst = -1; // -1 used when dst info is unknown return timetm; } - //! Convert a time_duration to a tm structure truncating any fractional seconds and zeroing fields for date components + //! Convert a time_duration to a tm structure truncating any fractional seconds and zeroing fields for date components inline std::tm to_tm(const boost::posix_time::time_duration& td) { - std::tm timetm; - timetm.tm_year = 0; - timetm.tm_mon = 0; - timetm.tm_mday = 0; - timetm.tm_wday = 0; - timetm.tm_yday = 0; - - timetm.tm_hour = date_time::absolute_value(td.hours()); + std::tm 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()); timetm.tm_isdst = -1; // -1 used when dst info is unknown @@ -65,12 +60,12 @@ namespace posix_time { #if defined(BOOST_HAS_FTIME) - + //! Function to create a time object from an initialized FILETIME struct. /*! Function to create a time object from an initialized FILETIME struct. - * A FILETIME struct holds 100-nanosecond units (0.0000001). When - * built with microsecond resolution the FILETIME's sub second value - * will be truncated. Nanosecond resolution has no truncation. + * A FILETIME struct holds 100-nanosecond units (0.0000001). When + * built with microsecond resolution the FILETIME's sub second value + * will be truncated. Nanosecond resolution has no truncation. * * \note FILETIME is part of the Win32 API, so it is not portable to non-windows * platforms. diff --git a/3rdParty/Boost/src/boost/date_time/posix_time/posix_time_config.hpp b/3rdParty/Boost/src/boost/date_time/posix_time/posix_time_config.hpp index c40a15c..60c3f7e 100644 --- a/3rdParty/Boost/src/boost/date_time/posix_time/posix_time_config.hpp +++ b/3rdParty/Boost/src/boost/date_time/posix_time/posix_time_config.hpp @@ -2,22 +2,22 @@ #define POSIX_TIME_CONFIG_HPP___ /* Copyright (c) 2002,2003,2005 CrystalClear Software, Inc. - * Use, modification and distribution is subject to the + * Use, modification and distribution is subject to the * 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: 2008-10-13 05:00:03 -0400 (Mon, 13 Oct 2008) $ + * $Date: 2009-06-04 07:52:28 -0400 (Thu, 04 Jun 2009) $ */ -#include "boost/date_time/time_duration.hpp" -#include "boost/date_time/time_resolution_traits.hpp" -#include "boost/date_time/gregorian/gregorian_types.hpp" -#include "boost/date_time/wrapping_int.hpp" -#include "boost/limits.hpp" -#include "boost/date_time/compiler_config.hpp" -#include "boost/cstdint.hpp" -#include <boost/config/no_tr1/cmath.hpp> #include <cstdlib> //for MCW 7.2 std::abs(long long) +#include <boost/limits.hpp> +#include <boost/cstdint.hpp> +#include <boost/config/no_tr1/cmath.hpp> +#include <boost/date_time/time_duration.hpp> +#include <boost/date_time/time_resolution_traits.hpp> +#include <boost/date_time/gregorian/gregorian_types.hpp> +#include <boost/date_time/wrapping_int.hpp> +#include <boost/date_time/compiler_config.hpp> namespace boost { namespace posix_time { @@ -30,7 +30,7 @@ namespace posix_time { #define BOOST_DATE_TIME_HAS_MILLISECONDS #define BOOST_DATE_TIME_HAS_MICROSECONDS #define BOOST_DATE_TIME_HAS_NANOSECONDS - typedef date_time::time_resolution_traits<boost::date_time::time_resolution_traits_adapted64_impl, boost::date_time::nano, + typedef date_time::time_resolution_traits<boost::date_time::time_resolution_traits_adapted64_impl, boost::date_time::nano, 1000000000, 9 > time_res_traits; #else // set up conditional test compilations @@ -38,14 +38,14 @@ namespace posix_time { #define BOOST_DATE_TIME_HAS_MICROSECONDS #undef BOOST_DATE_TIME_HAS_NANOSECONDS typedef date_time::time_resolution_traits< - boost::date_time::time_resolution_traits_adapted64_impl, boost::date_time::micro, + boost::date_time::time_resolution_traits_adapted64_impl, boost::date_time::micro, 1000000, 6 > time_res_traits; // #undef BOOST_DATE_TIME_HAS_MILLISECONDS // #undef BOOST_DATE_TIME_HAS_MICROSECONDS // #undef BOOST_DATE_TIME_HAS_NANOSECONDS -// typedef date_time::time_resolution_traits<boost::int64_t, boost::date_time::tenth, +// typedef date_time::time_resolution_traits<boost::int64_t, boost::date_time::tenth, // 10, 0 > time_res_traits; #endif @@ -82,8 +82,8 @@ namespace posix_time { //Give duration access to ticks constructor -- hide from users friend class date_time::time_duration<time_duration, time_res_traits>; private: - explicit time_duration(impl_type ticks) : - date_time::time_duration<time_duration, time_res_traits>(ticks) + explicit time_duration(impl_type tick_count) : + date_time::time_duration<time_duration, time_res_traits>(tick_count) {} }; @@ -134,7 +134,7 @@ namespace posix_time { } }; - class posix_time_system_config + class posix_time_system_config { public: typedef simple_time_rep time_rep_type; @@ -143,7 +143,7 @@ namespace posix_time { typedef time_duration time_duration_type; typedef time_res_traits::tick_type int_type; typedef time_res_traits resolution_traits; -#if (defined(BOOST_DATE_TIME_NO_MEMBER_INIT)) //help bad compilers +#if (defined(BOOST_DATE_TIME_NO_MEMBER_INIT)) //help bad compilers #else BOOST_STATIC_CONSTANT(boost::int64_t, tick_per_second = 1000000000); #endif @@ -151,7 +151,7 @@ namespace posix_time { #else - class millisec_posix_time_system_config + class millisec_posix_time_system_config { public: typedef boost::int64_t time_rep_type; @@ -162,7 +162,7 @@ namespace posix_time { typedef time_res_traits::tick_type int_type; typedef time_res_traits::impl_type impl_type; typedef time_res_traits resolution_traits; -#if (defined(BOOST_DATE_TIME_NO_MEMBER_INIT)) //help bad compilers +#if (defined(BOOST_DATE_TIME_NO_MEMBER_INIT)) //help bad compilers #else BOOST_STATIC_CONSTANT(boost::int64_t, tick_per_second = 1000000); #endif diff --git a/3rdParty/Boost/src/boost/date_time/posix_time/time_formatters.hpp b/3rdParty/Boost/src/boost/date_time/posix_time/time_formatters.hpp index dc8facf..466331b 100644 --- a/3rdParty/Boost/src/boost/date_time/posix_time/time_formatters.hpp +++ b/3rdParty/Boost/src/boost/date_time/posix_time/time_formatters.hpp @@ -2,24 +2,24 @@ #define POSIXTIME_FORMATTERS_HPP___ /* Copyright (c) 2002-2004 CrystalClear Software, Inc. - * Use, modification and distribution is subject to the + * Use, modification and distribution is subject to the * 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: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + * $Date: 2010-01-10 14:17:23 -0500 (Sun, 10 Jan 2010) $ */ -#include "boost/date_time/gregorian/gregorian.hpp" -#include "boost/date_time/compiler_config.hpp" -#include "boost/date_time/iso_format.hpp" -#include "boost/date_time/date_format_simple.hpp" -#include "boost/date_time/posix_time/posix_time_types.hpp" -#include "boost/date_time/time_formatting_streams.hpp" +#include <boost/date_time/gregorian/gregorian.hpp> +#include <boost/date_time/compiler_config.hpp> +#include <boost/date_time/iso_format.hpp> +#include <boost/date_time/date_format_simple.hpp> +#include <boost/date_time/posix_time/posix_time_types.hpp> +#include <boost/date_time/time_formatting_streams.hpp> +#include <boost/date_time/time_resolution_traits.hpp> // absolute_value +#include <boost/date_time/time_parsing.hpp> -#include "boost/date_time/time_parsing.hpp" - -/* NOTE: The "to_*_string" code for older compilers, ones that define - * BOOST_DATE_TIME_INCLUDE_LIMITED_HEADERS, is located in +/* NOTE: The "to_*_string" code for older compilers, ones that define + * BOOST_DATE_TIME_INCLUDE_LIMITED_HEADERS, is located in * formatters_limited.hpp */ @@ -57,27 +57,27 @@ namespace posix_time { if(td.is_negative()) { ss << '-'; } - ss << std::setw(2) << std::setfill(fill_char) + ss << std::setw(2) << std::setfill(fill_char) << date_time::absolute_value(td.hours()) << ":"; - ss << std::setw(2) << std::setfill(fill_char) + ss << std::setw(2) << std::setfill(fill_char) << date_time::absolute_value(td.minutes()) << ":"; - ss << std::setw(2) << std::setfill(fill_char) + ss << std::setw(2) << std::setfill(fill_char) << date_time::absolute_value(td.seconds()); //TODO the following is totally non-generic, yelling FIXME #if (defined(BOOST_MSVC) && (_MSC_VER < 1300)) - boost::int64_t frac_sec = + boost::int64_t frac_sec = date_time::absolute_value(td.fractional_seconds()); // JDG [7/6/02 VC++ compatibility] charT buff[32]; _i64toa(frac_sec, buff, 10); #else - time_duration::fractional_seconds_type frac_sec = + time_duration::fractional_seconds_type frac_sec = date_time::absolute_value(td.fractional_seconds()); #endif if (frac_sec != 0) { ss << "." << std::setw(time_duration::num_fractional_digits()) << std::setfill(fill_char) - + // JDG [7/6/02 VC++ compatibility] #if (defined(BOOST_MSVC) && (_MSC_VER < 1300)) << buff; @@ -99,7 +99,7 @@ namespace posix_time { // template function called by wrapper functions: // to_*_string(time_duration) & to_*_wstring(time_duration) template<class charT> - inline std::basic_string<charT> to_iso_string_type(time_duration td) + inline std::basic_string<charT> to_iso_string_type(time_duration td) { std::basic_ostringstream<charT> ss; if(td.is_special()) { @@ -126,27 +126,27 @@ namespace posix_time { if(td.is_negative()) { ss << '-'; } - ss << std::setw(2) << std::setfill(fill_char) + ss << std::setw(2) << std::setfill(fill_char) << date_time::absolute_value(td.hours()); - ss << std::setw(2) << std::setfill(fill_char) + ss << std::setw(2) << std::setfill(fill_char) << date_time::absolute_value(td.minutes()); - ss << std::setw(2) << std::setfill(fill_char) + ss << std::setw(2) << std::setfill(fill_char) << date_time::absolute_value(td.seconds()); //TODO the following is totally non-generic, yelling FIXME #if (defined(BOOST_MSVC) && (_MSC_VER < 1300)) - boost::int64_t frac_sec = + boost::int64_t frac_sec = date_time::absolute_value(td.fractional_seconds()); // JDG [7/6/02 VC++ compatibility] charT buff[32]; _i64toa(frac_sec, buff, 10); #else - time_duration::fractional_seconds_type frac_sec = + time_duration::fractional_seconds_type frac_sec = date_time::absolute_value(td.fractional_seconds()); #endif if (frac_sec != 0) { ss << "." << std::setw(time_duration::num_fractional_digits()) << std::setfill(fill_char) - + // JDG [7/6/02 VC++ compatibility] #if (defined(BOOST_MSVC) && (_MSC_VER < 1300)) << buff; @@ -168,7 +168,7 @@ namespace posix_time { /*!\ingroup time_format */ template<class charT> - inline std::basic_string<charT> to_simple_string_type(ptime t) + inline std::basic_string<charT> to_simple_string_type(ptime t) { // can't use this w/gcc295, no to_simple_string_type<>(td) available std::basic_string<charT> ts = gregorian::to_simple_string_type<charT>(t.date());// + " "; @@ -184,10 +184,10 @@ namespace posix_time { return to_simple_string_type<char>(t); } - // function called by wrapper functions to_*_string(time_period) + // function called by wrapper functions to_*_string(time_period) // & to_*_wstring(time_period) template<class charT> - inline std::basic_string<charT> to_simple_string_type(time_period tp) + inline std::basic_string<charT> to_simple_string_type(time_period tp) { charT beg = '[', mid = '/', end = ']'; std::basic_string<charT> d1(to_simple_string_type<charT>(tp.begin())); @@ -201,10 +201,10 @@ namespace posix_time { return to_simple_string_type<char>(tp); } - // function called by wrapper functions to_*_string(time_period) + // function called by wrapper functions to_*_string(time_period) // & to_*_wstring(time_period) template<class charT> - inline std::basic_string<charT> to_iso_string_type(ptime t) + inline std::basic_string<charT> to_iso_string_type(ptime t) { std::basic_string<charT> ts = gregorian::to_iso_string_type<charT>(t.date());// + "T"; if(!t.time_of_day().is_special()) { @@ -223,10 +223,10 @@ namespace posix_time { } - // function called by wrapper functions to_*_string(time_period) + // function called by wrapper functions to_*_string(time_period) // & to_*_wstring(time_period) template<class charT> - inline std::basic_string<charT> to_iso_extended_string_type(ptime t) + inline std::basic_string<charT> to_iso_extended_string_type(ptime t) { std::basic_string<charT> ts = gregorian::to_iso_extended_string_type<charT>(t.date());// + "T"; if(!t.time_of_day().is_special()) { diff --git a/3rdParty/Boost/src/boost/date_time/posix_time/time_formatters_limited.hpp b/3rdParty/Boost/src/boost/date_time/posix_time/time_formatters_limited.hpp index def5169..d0e959e 100644 --- a/3rdParty/Boost/src/boost/date_time/posix_time/time_formatters_limited.hpp +++ b/3rdParty/Boost/src/boost/date_time/posix_time/time_formatters_limited.hpp @@ -2,20 +2,21 @@ #define POSIXTIME_FORMATTERS_LIMITED_HPP___ /* Copyright (c) 2002,2003 CrystalClear Software, Inc. - * Use, modification and distribution is subject to the + * Use, modification and distribution is subject to the * 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: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + * $Date: 2010-01-10 14:17:23 -0500 (Sun, 10 Jan 2010) $ */ -#include "boost/date_time/gregorian/gregorian.hpp" -#include "boost/date_time/compiler_config.hpp" -#include "boost/date_time/iso_format.hpp" -#include "boost/date_time/date_format_simple.hpp" -#include "boost/date_time/posix_time/posix_time_types.hpp" -#include "boost/date_time/time_formatting_streams.hpp" - +#include <boost/date_time/gregorian/gregorian.hpp> +#include <boost/date_time/compiler_config.hpp> +#include <boost/date_time/iso_format.hpp> +#include <boost/date_time/date_format_simple.hpp> +#include <boost/date_time/posix_time/posix_time_types.hpp> +#include <boost/date_time/time_formatting_streams.hpp> +#include <boost/date_time/time_resolution_traits.hpp> // absolute_value + namespace boost { namespace posix_time { @@ -49,27 +50,27 @@ namespace posix_time { if(td.is_negative()) { ss << '-'; } - ss << std::setw(2) << std::setfill('0') + ss << std::setw(2) << std::setfill('0') << date_time::absolute_value(td.hours()) << ":"; - ss << std::setw(2) << std::setfill('0') + ss << std::setw(2) << std::setfill('0') << date_time::absolute_value(td.minutes()) << ":"; - ss << std::setw(2) << std::setfill('0') + ss << std::setw(2) << std::setfill('0') << date_time::absolute_value(td.seconds()); //TODO the following is totally non-generic, yelling FIXME #if (defined(BOOST_MSVC) && (_MSC_VER < 1300)) - boost::int64_t frac_sec = + boost::int64_t frac_sec = date_time::absolute_value(td.fractional_seconds()); // JDG [7/6/02 VC++ compatibility] char buff[32]; _i64toa(frac_sec, buff, 10); #else - time_duration::fractional_seconds_type frac_sec = + time_duration::fractional_seconds_type frac_sec = date_time::absolute_value(td.fractional_seconds()); #endif if (frac_sec != 0) { ss << "." << std::setw(time_duration::num_fractional_digits()) << std::setfill('0') - + // JDG [7/6/02 VC++ compatibility] #if (defined(BOOST_MSVC) && (_MSC_VER < 1300)) << buff; @@ -84,9 +85,9 @@ namespace posix_time { //! Time duration in iso format -hhmmss,fffffff Example: 10:09:03,0123456 /*!\ingroup time_format */ - inline - std::string - to_iso_string(time_duration td) + inline + std::string + to_iso_string(time_duration td) { std::ostringstream ss; if(td.is_special()) { @@ -112,27 +113,27 @@ namespace posix_time { if(td.is_negative()) { ss << '-'; } - ss << std::setw(2) << std::setfill('0') + ss << std::setw(2) << std::setfill('0') << date_time::absolute_value(td.hours()); - ss << std::setw(2) << std::setfill('0') + ss << std::setw(2) << std::setfill('0') << date_time::absolute_value(td.minutes()); - ss << std::setw(2) << std::setfill('0') + ss << std::setw(2) << std::setfill('0') << date_time::absolute_value(td.seconds()); //TODO the following is totally non-generic, yelling FIXME #if (defined(BOOST_MSVC) && (_MSC_VER < 1300)) - boost::int64_t frac_sec = + boost::int64_t frac_sec = date_time::absolute_value(td.fractional_seconds()); // JDG [7/6/02 VC++ compatibility] char buff[32]; _i64toa(frac_sec, buff, 10); #else - time_duration::fractional_seconds_type frac_sec = + time_duration::fractional_seconds_type frac_sec = date_time::absolute_value(td.fractional_seconds()); #endif if (frac_sec != 0) { ss << "." << std::setw(time_duration::num_fractional_digits()) << std::setfill('0') - + // JDG [7/6/02 VC++ compatibility] #if (defined(BOOST_MSVC) && (_MSC_VER < 1300)) << buff; @@ -147,9 +148,9 @@ namespace posix_time { //! Time to simple format CCYY-mmm-dd hh:mm:ss.fffffff /*!\ingroup time_format */ - inline - std::string - to_simple_string(ptime t) + inline + std::string + to_simple_string(ptime t) { std::string ts = gregorian::to_simple_string(t.date());// + " "; if(!t.time_of_day().is_special()) { @@ -163,9 +164,9 @@ namespace posix_time { //! Convert to string of form [YYYY-mmm-DD HH:MM::SS.ffffff/YYYY-mmm-DD HH:MM::SS.fffffff] /*!\ingroup time_format */ - inline - std::string - to_simple_string(time_period tp) + inline + std::string + to_simple_string(time_period tp) { std::string d1(to_simple_string(tp.begin())); std::string d2(to_simple_string(tp.last())); @@ -175,8 +176,8 @@ namespace posix_time { //! Convert iso short form YYYYMMDDTHHMMSS where T is the date-time separator /*!\ingroup time_format */ - inline - std::string to_iso_string(ptime t) + inline + std::string to_iso_string(ptime t) { std::string ts = gregorian::to_iso_string(t.date());// + "T"; if(!t.time_of_day().is_special()) { @@ -190,9 +191,9 @@ namespace posix_time { //! Convert to form YYYY-MM-DDTHH:MM:SS where T is the date-time separator /*!\ingroup time_format */ - inline - std::string - to_iso_extended_string(ptime t) + inline + std::string + to_iso_extended_string(ptime t) { std::string ts = gregorian::to_iso_extended_string(t.date());// + "T"; if(!t.time_of_day().is_special()) { |