Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r65949 - sandbox/chrono/boost/chrono/detail/inlined/mac
From: vicente.botet_at_[hidden]
Date: 2010-10-13 19:42:29


Author: viboes
Date: 2010-10-13 19:42:27 EDT (Wed, 13 Oct 2010)
New Revision: 65949
URL: http://svn.boost.org/trac/boost/changeset/65949

Log:
Chrono:
* More on making configurable header-only library
* Fix mac original error
Text files modified:
   sandbox/chrono/boost/chrono/detail/inlined/mac/chrono.hpp | 1
   sandbox/chrono/boost/chrono/detail/inlined/mac/process_clock.hpp | 56 ++++++++++++++++++---------------------
   sandbox/chrono/boost/chrono/detail/inlined/mac/thread_clock.hpp | 4 --
   3 files changed, 27 insertions(+), 34 deletions(-)

Modified: sandbox/chrono/boost/chrono/detail/inlined/mac/chrono.hpp
==============================================================================
--- sandbox/chrono/boost/chrono/detail/inlined/mac/chrono.hpp (original)
+++ sandbox/chrono/boost/chrono/detail/inlined/mac/chrono.hpp 2010-10-13 19:42:27 EDT (Wed, 13 Oct 2010)
@@ -1,6 +1,7 @@
 // mac/chrono.cpp --------------------------------------------------------------//
 
 // Copyright Beman Dawes 2008
+// Copyright 2009-2010 Vicente J. Botet Escriba
 
 // Distributed under the Boost Software License, Version 1.0.
 // See http://www.boost.org/LICENSE_1_0.txt

Modified: sandbox/chrono/boost/chrono/detail/inlined/mac/process_clock.hpp
==============================================================================
--- sandbox/chrono/boost/chrono/detail/inlined/mac/process_clock.hpp (original)
+++ sandbox/chrono/boost/chrono/detail/inlined/mac/process_clock.hpp 2010-10-13 19:42:27 EDT (Wed, 13 Oct 2010)
@@ -10,10 +10,6 @@
 
 //--------------------------------------------------------------------------------------//
 
-// define BOOST_CHRONO_SOURCE so that <boost/chrono/config.hpp> knows
-// the library is being built (possibly exporting rather than importing code)
-//#define BOOST_CHRONO_SOURCE
-
 #include <boost/chrono/config.hpp>
 #include <boost/chrono/process_times.hpp>
 #include <cassert>
@@ -21,26 +17,6 @@
 #include <sys/time.h> //for gettimeofday and timeval
 # include <unistd.h>
 
-namespace
-{
- long tick_factor() // multiplier to convert ticks
- // to nanoseconds; -1 if unknown
- {
- static long factor = 0;
- if ( !factor )
- {
- if ( (factor = ::sysconf( _SC_CLK_TCK )) <= 0 )
- factor = -1;
- else
- {
- assert( factor <= 1000000l ); // doesn't handle large ticks
- factor = 1000000l / factor; // compute factor
- if ( !factor ) factor = -1;
- }
- }
- return factor;
- }
-}
 
 #else
 # error unknown API
@@ -48,8 +24,28 @@
 
 namespace boost
 {
- namespace chrono
- {
+namespace chrono
+{
+namespace chrono_detail
+{
+ long tick_factor() // multiplier to convert ticks
+ // to nanoseconds; -1 if unknown
+ {
+ static long factor = 0;
+ if ( !factor )
+ {
+ if ( (factor = ::sysconf( _SC_CLK_TCK )) <= 0 )
+ factor = -1;
+ else
+ {
+ assert( factor <= 1000000l ); // doesn't handle large ticks
+ factor = 1000000l / factor; // compute factor
+ if ( !factor ) factor = -1;
+ }
+ }
+ return factor;
+ }
+ }
 
     void process_clock::now( process_times & times_, system::error_code & ec )
     {
@@ -72,11 +68,11 @@
         times_.real = microseconds(c);
         times_.system = microseconds(tm.tms_stime + tm.tms_cstime);
         times_.user = microseconds(tm.tms_utime + tm.tms_cutime);
- if ( tick_factor() != -1 )
+ if ( chrono_detail::tick_factor() != -1 )
         {
- times_.real *= tick_factor();
- times_.user *= tick_factor();
- times_.system *= tick_factor();
+ times_.real *= chrono_detail::tick_factor();
+ times_.user *= chrono_detail::tick_factor();
+ times_.system *= chrono_detail::tick_factor();
           ec.clear();
         }
         else

Modified: sandbox/chrono/boost/chrono/detail/inlined/mac/thread_clock.hpp
==============================================================================
--- sandbox/chrono/boost/chrono/detail/inlined/mac/thread_clock.hpp (original)
+++ sandbox/chrono/boost/chrono/detail/inlined/mac/thread_clock.hpp 2010-10-13 19:42:27 EDT (Wed, 13 Oct 2010)
@@ -9,10 +9,6 @@
 
 //--------------------------------------------------------------------------------------//
 
-// define BOOST_CHRONO_SOURCE so that <boost/chrono/config.hpp> knows
-// the library is being built (possibly exporting rather than importing code)
-//#define BOOST_CHRONO_SOURCE
-
 #include <boost/chrono/config.hpp>
 #include <boost/chrono/detail/inlined/posix/thread_clock.hpp>
 #include <cassert>


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