Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r65567 - in sandbox/chrono/boost/conversion: . boost
From: vicente.botet_at_[hidden]
Date: 2010-09-23 18:27:46


Author: viboes
Date: 2010-09-23 18:27:45 EDT (Thu, 23 Sep 2010)
New Revision: 65567
URL: http://svn.boost.org/trac/boost/changeset/65567

Log:
Chrono: update copy of conversion
Text files modified:
   sandbox/chrono/boost/conversion/assign_to.hpp | 1 +
   sandbox/chrono/boost/conversion/boost/chrono_duration_to_posix_time_duration.hpp | 8 ++++----
   sandbox/chrono/boost/conversion/boost/chrono_time_point_to_posix_time_ptime.hpp | 15 ++++++++-------
   sandbox/chrono/boost/conversion/convert_to.hpp | 3 ++-
   4 files changed, 15 insertions(+), 12 deletions(-)

Modified: sandbox/chrono/boost/conversion/assign_to.hpp
==============================================================================
--- sandbox/chrono/boost/conversion/assign_to.hpp (original)
+++ sandbox/chrono/boost/conversion/assign_to.hpp 2010-09-23 18:27:45 EDT (Thu, 23 Sep 2010)
@@ -55,6 +55,7 @@
 
     template <typename Target, typename Source>
     Target& assign_to(Target& to, const Source& from, boost::dummy::base_tag<Target> const& p=boost::dummy::base_tag<Target>()) {
+ (void)p;
         return conversion_impl::assign_to_impl<Target, Source>(to, from);
     }
 }

Modified: sandbox/chrono/boost/conversion/boost/chrono_duration_to_posix_time_duration.hpp
==============================================================================
--- sandbox/chrono/boost/conversion/boost/chrono_duration_to_posix_time_duration.hpp (original)
+++ sandbox/chrono/boost/conversion/boost/chrono_duration_to_posix_time_duration.hpp 2010-09-23 18:27:45 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/chrono/boost/conversion/boost/chrono_time_point_to_posix_time_ptime.hpp
==============================================================================
--- sandbox/chrono/boost/conversion/boost/chrono_time_point_to_posix_time_ptime.hpp (original)
+++ sandbox/chrono/boost/conversion/boost/chrono_time_point_to_posix_time_ptime.hpp 2010-09-23 18:27:45 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&

Modified: sandbox/chrono/boost/conversion/convert_to.hpp
==============================================================================
--- sandbox/chrono/boost/conversion/convert_to.hpp (original)
+++ sandbox/chrono/boost/conversion/convert_to.hpp 2010-09-23 18:27:45 EDT (Thu, 23 Sep 2010)
@@ -24,7 +24,7 @@
             struct convert_to {
                 inline static To apply(const From& val)
                 {
- return To(val);
+ return To((val));
                 }
             };
         }
@@ -44,6 +44,7 @@
     }
     template <typename Target, typename Source>
     Target convert_to(Source const& from, boost::dummy::base_tag<Target> const& p=boost::dummy::base_tag<Target>()) {
+ (void)p;
         return conversion_impl::convert_to_impl<Target>(from);
     }
 


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