diff options
author | DongHun Kwak <dh0128.kwak@samsung.com> | 2016-03-21 15:45:20 +0900 |
---|---|---|
committer | DongHun Kwak <dh0128.kwak@samsung.com> | 2016-03-21 15:46:37 +0900 |
commit | 733b5d5ae2c5d625211e2985ac25728ac3f54883 (patch) | |
tree | a5b214744b256f07e1dc2bd7273035a7808c659f /boost/date_time | |
parent | 08c1e93fa36a49f49325a07fe91ff92c964c2b6c (diff) | |
download | boost-733b5d5ae2c5d625211e2985ac25728ac3f54883.tar.gz boost-733b5d5ae2c5d625211e2985ac25728ac3f54883.tar.bz2 boost-733b5d5ae2c5d625211e2985ac25728ac3f54883.zip |
Imported Upstream version 1.58.0upstream/1.58.0
Change-Id: If0072143aa26874812e0db6872e1efb10a3e5e94
Signed-off-by: DongHun Kwak <dh0128.kwak@samsung.com>
Diffstat (limited to 'boost/date_time')
-rw-r--r-- | boost/date_time/microsec_time_clock.hpp | 2 | ||||
-rw-r--r-- | boost/date_time/posix_time/conversion.hpp | 8 | ||||
-rw-r--r-- | boost/date_time/time.hpp | 2 | ||||
-rw-r--r-- | boost/date_time/time_duration.hpp | 2 | ||||
-rw-r--r-- | boost/date_time/time_resolution_traits.hpp | 10 |
5 files changed, 18 insertions, 6 deletions
diff --git a/boost/date_time/microsec_time_clock.hpp b/boost/date_time/microsec_time_clock.hpp index bffc74137e..1dd08ffebf 100644 --- a/boost/date_time/microsec_time_clock.hpp +++ b/boost/date_time/microsec_time_clock.hpp @@ -90,7 +90,7 @@ namespace date_time { uint64_t micros = winapi::file_time_to_microseconds(ft); // it will not wrap, since ft is the current time // and cannot be before 1970-Jan-01 std::time_t t = static_cast<std::time_t>(micros / 1000000UL); // seconds since epoch - // microseconds -- static casts supress warnings + // microseconds -- static casts suppress warnings boost::uint32_t sub_sec = static_cast<boost::uint32_t>(micros % 1000000UL); #else #error Internal Boost.DateTime error: BOOST_DATE_TIME_HAS_HIGH_PRECISION_CLOCK is defined, however neither gettimeofday nor FILETIME support is detected. diff --git a/boost/date_time/posix_time/conversion.hpp b/boost/date_time/posix_time/conversion.hpp index 59e5cb7c12..ed3d4867e9 100644 --- a/boost/date_time/posix_time/conversion.hpp +++ b/boost/date_time/posix_time/conversion.hpp @@ -30,6 +30,14 @@ namespace posix_time { return start + seconds(static_cast<long>(t)); } + //! Function that converts a ptime into a time_t + inline + std::time_t to_time_t(ptime pt) + { + time_duration dur = pt - ptime(gregorian::date(1970,1,1)); + return std::time_t(dur.total_seconds()); + } + //! Convert a time to a tm structure truncating any fractional seconds inline std::tm to_tm(const boost::posix_time::ptime& t) { diff --git a/boost/date_time/time.hpp b/boost/date_time/time.hpp index 0a7810a0ef..632f10d7f2 100644 --- a/boost/date_time/time.hpp +++ b/boost/date_time/time.hpp @@ -49,6 +49,8 @@ namespace date_time { > > { public: + // A tag for type categorization. Can be used to detect Boost.DateTime time points in generic code. + typedef void _is_boost_date_time_time_point; typedef T time_type; typedef typename time_system::time_rep_type time_rep_type; typedef typename time_system::date_type date_type; diff --git a/boost/date_time/time_duration.hpp b/boost/date_time/time_duration.hpp index 92a0e2d59a..58768bcd2d 100644 --- a/boost/date_time/time_duration.hpp +++ b/boost/date_time/time_duration.hpp @@ -42,6 +42,8 @@ namespace date_time { * either (haven't tried) */ { public: + // A tag for type categorization. Can be used to detect Boost.DateTime duration types in generic code. + typedef void _is_boost_date_time_duration; typedef T duration_type; //the subclass typedef rep_type traits_type; typedef typename rep_type::day_type day_type; diff --git a/boost/date_time/time_resolution_traits.hpp b/boost/date_time/time_resolution_traits.hpp index 37785d0e68..3b6134cf1c 100644 --- a/boost/date_time/time_resolution_traits.hpp +++ b/boost/date_time/time_resolution_traits.hpp @@ -68,16 +68,16 @@ namespace date_time { typename frac_sec_type::int_type resolution_adjust, #endif unsigned short frac_digits, - typename v_type = boost::int32_t > + typename var_type = boost::int32_t > class time_resolution_traits { public: typedef typename frac_sec_type::int_type fractional_seconds_type; typedef typename frac_sec_type::int_type tick_type; typedef typename frac_sec_type::impl_type impl_type; - typedef v_type day_type; - typedef v_type hour_type; - typedef v_type min_type; - typedef v_type sec_type; + typedef var_type day_type; + typedef var_type hour_type; + typedef var_type min_type; + typedef var_type sec_type; // bring in function from frac_sec_type traits structs static fractional_seconds_type as_number(impl_type i) |