|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r65566 - sandbox/conversion/boost/conversion/boost
From: vicente.botet_at_[hidden]
Date: 2010-09-23 18:22:25
Author: viboes
Date: 2010-09-23 18:22:24 EDT (Thu, 23 Sep 2010)
New Revision: 65566
URL: http://svn.boost.org/trac/boost/changeset/65566
Log:
Conversion: Fix ADL issue + duration_cast needed
Text files modified:
sandbox/conversion/boost/conversion/boost/chrono_duration_to_posix_time_duration.hpp | 8 ++++----
sandbox/conversion/boost/conversion/boost/chrono_time_point_to_posix_time_ptime.hpp | 15 ++++++++-------
2 files changed, 12 insertions(+), 11 deletions(-)
Modified: sandbox/conversion/boost/conversion/boost/chrono_duration_to_posix_time_duration.hpp
==============================================================================
--- sandbox/conversion/boost/conversion/boost/chrono_duration_to_posix_time_duration.hpp (original)
+++ sandbox/conversion/boost/conversion/boost/chrono_duration_to_posix_time_duration.hpp 2010-09-23 18:22:24 EDT (Thu, 23 Sep 2010)
@@ -95,11 +95,11 @@
}
namespace posix_time {
- template < class Rep, class Period>
- inline chrono::duration<Rep, Period> convert_to(time_duration const & from
- , boost::dummy::type_tag<chrono::duration<Rep, Period> > const&)
+ template < class Duration>
+ inline Duration convert_to(time_duration const & from
+ , boost::dummy::type_tag<Duration> const&)
{
- return chrono::duration_cast<chrono::duration<Rep, Period> >(chrono::nanoseconds(from.total_nanoseconds()));
+ return chrono::duration_cast<Duration>(chrono::nanoseconds(from.total_nanoseconds()));
}
template < class Rep, class Period>
Modified: sandbox/conversion/boost/conversion/boost/chrono_time_point_to_posix_time_ptime.hpp
==============================================================================
--- sandbox/conversion/boost/conversion/boost/chrono_time_point_to_posix_time_ptime.hpp (original)
+++ sandbox/conversion/boost/conversion/boost/chrono_time_point_to_posix_time_ptime.hpp 2010-09-23 18:22:24 EDT (Thu, 23 Sep 2010)
@@ -57,8 +57,7 @@
posix_time::time_duration const time_since_epoch=from-posix_time::from_time_t(0);
chrono::time_point<Clock, Duration> t=chrono::system_clock::from_time_t(time_since_epoch.total_seconds());
long nsec=time_since_epoch.fractional_seconds()*(1000000000/time_since_epoch.ticks_per_second());
- return t+chrono::nanoseconds(nsec);
-
+ return t+chrono::duration_cast<Duration>(chrono::nanoseconds(nsec));
}
};
template < class Clock, class Duration>
@@ -102,17 +101,19 @@
}
}
+
namespace posix_time {
- template < class Clock, class Duration>
- inline chrono::time_point<Clock, Duration> convert_to(const ptime& from
- , boost::dummy::type_tag<chrono::time_point<Clock, Duration> > const&)
+ template < class TP>
+ inline TP convert_to(const ptime& from
+ , boost::dummy::type_tag<TP > const&)
{
time_duration const time_since_epoch=from-from_time_t(0);
- chrono::time_point<Clock, Duration> t=chrono::system_clock::from_time_t(time_since_epoch.total_seconds());
+ TP t=chrono::system_clock::from_time_t(time_since_epoch.total_seconds());
long nsec=time_since_epoch.fractional_seconds()*(1000000000/time_since_epoch.ticks_per_second());
- return t+chrono::nanoseconds(nsec);
+ return t+chrono::duration_cast<typename TP::duration>(chrono::nanoseconds(nsec));
}
+
template < class Clock, class Duration>
inline ptime& assign_to(ptime& to, const chrono::time_point<Clock, Duration>& from
, boost::dummy::type_tag<posix_time::ptime> const&
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk