Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r59369 - in sandbox/chrono/libs/chrono: example test
From: vicente.botet_at_[hidden]
Date: 2010-01-30 09:49:50


Author: viboes
Date: 2010-01-30 09:49:48 EST (Sat, 30 Jan 2010)
New Revision: 59369
URL: http://svn.boost.org/trac/boost/changeset/59369

Log:
Boost.Chrono: Version 0.4.0,
* rename digital_time by 24_hours

Added:
   sandbox/chrono/libs/chrono/example/t24_hours_example.cpp
      - copied, changed from r59080, /sandbox/chrono/libs/chrono/example/digital_time_example.cpp
Removed:
   sandbox/chrono/libs/chrono/example/digital_time_example.cpp
   sandbox/chrono/libs/chrono/test/test_system_clock.cpp
Text files modified:
   sandbox/chrono/libs/chrono/example/t24_hours_example.cpp | 10 +++++-----
   sandbox/chrono/libs/chrono/test/Jamfile.v2 | 4 ++--
   2 files changed, 7 insertions(+), 7 deletions(-)

Deleted: sandbox/chrono/libs/chrono/example/digital_time_example.cpp
==============================================================================
--- sandbox/chrono/libs/chrono/example/digital_time_example.cpp 2010-01-30 09:49:48 EST (Sat, 30 Jan 2010)
+++ (empty file)
@@ -1,35 +0,0 @@
-// digital_time_example.cpp ---------------------------------------------------//
-
-// Copyright Beman Dawes 2006, 2008
-
-// Distributed under the Boost Software License, Version 1.0.
-// See http://www.boost.org/LICENSE_1_0.txt
-
-// See http://www.boost.org/libs/chrono for documentation.
-
-#include <boost/chrono/stopwatch.hpp>
-#include <boost/chrono/stopwatch_reporter.hpp>
-#include <boost/chrono/process_cpu_clocks.hpp>
-#include <boost/chrono/digital_time_formatter.hpp>
-#include <cmath>
-
-using namespace boost::chrono;
-int f1(long j)
-{
- stopwatch_reporter<stopwatch<process_real_cpu_clock>, digital_time_formatter> hhmmss(BOOST_CHRONO_DIGITAL_TIME_FUNCTION_FORMAT);
- //stopwatch_reporter<stopwatch<process_real_cpu_clock>, digital_time_formatter> hhmmss;
-
- for ( long i = 0; i < j; ++i )
- std::sqrt( 123.456L ); // burn some time
-
- return 0;
-}
-int main()
-{
- stopwatch_reporter<stopwatch<process_real_cpu_clock>, digital_time_formatter> hhmmss(BOOST_CHRONO_DIGITAL_TIME_FUNCTION_FORMAT);
-
- f1(100000);
- f1(200000);
- f1(300000);
- return 0;
-}

Copied: sandbox/chrono/libs/chrono/example/t24_hours_example.cpp (from r59080, /sandbox/chrono/libs/chrono/example/digital_time_example.cpp)
==============================================================================
--- /sandbox/chrono/libs/chrono/example/digital_time_example.cpp (original)
+++ sandbox/chrono/libs/chrono/example/t24_hours_example.cpp 2010-01-30 09:49:48 EST (Sat, 30 Jan 2010)
@@ -1,4 +1,4 @@
-// digital_time_example.cpp ---------------------------------------------------//
+// t24_hours_example.cpp ---------------------------------------------------//
 
 // Copyright Beman Dawes 2006, 2008
 
@@ -10,14 +10,14 @@
 #include <boost/chrono/stopwatch.hpp>
 #include <boost/chrono/stopwatch_reporter.hpp>
 #include <boost/chrono/process_cpu_clocks.hpp>
-#include <boost/chrono/digital_time_formatter.hpp>
+#include <boost/chrono/t24_hours_formatter.hpp>
 #include <cmath>
 
 using namespace boost::chrono;
 int f1(long j)
 {
- stopwatch_reporter<stopwatch<process_real_cpu_clock>, digital_time_formatter> hhmmss(BOOST_CHRONO_DIGITAL_TIME_FUNCTION_FORMAT);
- //stopwatch_reporter<stopwatch<process_real_cpu_clock>, digital_time_formatter> hhmmss;
+ stopwatch_reporter<stopwatch<process_real_cpu_clock>, t24_hours_formatter> hhmmss(BOOST_CHRONO_24_HOURS_FUNCTION_FORMAT);
+ //stopwatch_reporter<stopwatch<process_real_cpu_clock>, t24_hours_formatter> hhmmss;
 
   for ( long i = 0; i < j; ++i )
     std::sqrt( 123.456L ); // burn some time
@@ -26,7 +26,7 @@
 }
 int main()
 {
- stopwatch_reporter<stopwatch<process_real_cpu_clock>, digital_time_formatter> hhmmss(BOOST_CHRONO_DIGITAL_TIME_FUNCTION_FORMAT);
+ stopwatch_reporter<stopwatch<process_real_cpu_clock>, t24_hours_formatter> hhmmss(BOOST_CHRONO_24_HOURS_FUNCTION_FORMAT);
 
   f1(100000);
   f1(200000);

Modified: sandbox/chrono/libs/chrono/test/Jamfile.v2
==============================================================================
--- sandbox/chrono/libs/chrono/test/Jamfile.v2 (original)
+++ sandbox/chrono/libs/chrono/test/Jamfile.v2 2010-01-30 09:49:48 EST (Sat, 30 Jan 2010)
@@ -118,8 +118,8 @@
         [ run ../example/stopclock_accumulator_example.cpp : : : : stopclock_accumulator_example_dll ]
         [ run ../example/loop_stopclock_accumulator_example.cpp : : : <link>static ]
         [ run ../example/loop_stopclock_accumulator_example.cpp : : : : loop_stopclock_accumulator_example_dll ]
- [ run ../example/digital_time_example.cpp : : : <link>static ]
- [ run ../example/digital_time_example.cpp : : : : digital_time_example_dll ]
+ [ run ../example/t24_hours_example.cpp : : : <link>static ]
+ [ run ../example/t24_hours_example.cpp : : : : t24_hours_example_dll ]
         [ run ../example/scoped_stopclock_example.cpp : : : <link>static ]
         [ run ../example/scoped_stopclock_example.cpp : : : : function_stopclock_example_dll ]
         [ link ../example/timex.cpp : <link>static ]

Deleted: sandbox/chrono/libs/chrono/test/test_system_clock.cpp
==============================================================================
--- sandbox/chrono/libs/chrono/test/test_system_clock.cpp 2010-01-30 09:49:48 EST (Sat, 30 Jan 2010)
+++ (empty file)
@@ -1,124 +0,0 @@
-// test_system_clock.cpp ----------------------------------------------------------//
-
-// Copyright 2008 Howard Hinnant
-// Copyright 2008 Beman Dawes
-// Copyright 2009 Vicente J. Botet Escriba
-
-// Distributed under the Boost Software License, Version 1.0.
-// See http://www.boost.org/LICENSE_1_0.txt
-
-/*
-This code was extracted by Vicente J. Botet Escriba from Beman Dawes time2_demo.cpp which
-was derived by Beman Dawes from Howard Hinnant's time2_demo prototype.
-Many thanks to Howard for making his code available under the Boost license.
-The original code was modified to conform to Boost conventions and to section
-20.9 Time utilities [time] of the C++ committee's working paper N2798.
-See http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2798.pdf.
-
-time2_demo contained this comment:
-
- Much thanks to Andrei Alexandrescu,
- Walter Brown,
- Peter Dimov,
- Jeff Garland,
- Terry Golubiewski,
- Daniel Krügler,
- Anthony Williams.
-*/
-
-#include <boost/chrono/chrono.hpp>
-#include <boost/type_traits.hpp>
-
-#include <iostream>
-
-using namespace boost::chrono;
-
-void test_system_clock()
-{
- std::cout << "system_clock test" << std::endl;
- system_clock::duration delay = milliseconds(5);
- system_clock::time_point start = system_clock::now();
- while (system_clock::now() - start <= delay)
- ;
- system_clock::time_point stop = system_clock::now();
- system_clock::duration elapsed = stop - start;
- std::cout << "paused " << nanoseconds(elapsed).count() << " nanoseconds\n";
- start = system_clock::now();
- stop = system_clock::now();
- std::cout << "system_clock resolution estimate: " << nanoseconds(stop-start).count() << " nanoseconds\n";
-}
-
-void test_monotonic_clock()
-{
-#ifdef BOOST_CHRONO_HAS_CLOCK_MONOTONIC
- std::cout << "monotonic_clock test" << std::endl;
- monotonic_clock::duration delay = milliseconds(5);
- monotonic_clock::time_point start = monotonic_clock::now();
- while (monotonic_clock::now() - start <= delay)
- ;
- monotonic_clock::time_point stop = monotonic_clock::now();
- monotonic_clock::duration elapsed = stop - start;
- std::cout << "paused " << nanoseconds(elapsed).count() << " nanoseconds\n";
- start = monotonic_clock::now();
- stop = monotonic_clock::now();
- std::cout << "monotonic_clock resolution estimate: " << nanoseconds(stop-start).count() << " nanoseconds\n";
-#endif
-}
-void test_hi_resolution_clock()
-{
- std::cout << "high_resolution_clock test" << std::endl;
- high_resolution_clock::duration delay = milliseconds(5);
- high_resolution_clock::time_point start = high_resolution_clock::now();
- while (high_resolution_clock::now() - start <= delay)
- ;
- high_resolution_clock::time_point stop = high_resolution_clock::now();
- high_resolution_clock::duration elapsed = stop - start;
- std::cout << "paused " << nanoseconds(elapsed).count() << " nanoseconds\n";
- start = high_resolution_clock::now();
- stop = high_resolution_clock::now();
- std::cout << "high_resolution_clock resolution estimate: " << nanoseconds(stop-start).count() << " nanoseconds\n";
-}
-
-//void test_mixed_clock()
-//{
-// std::cout << "mixed clock test" << std::endl;
-// high_resolution_clock::time_point hstart = high_resolution_clock::now();
-// std::cout << "Add 5 milliseconds to a high_resolution_clock::time_point\n";
-// monotonic_clock::time_point mend = hstart + milliseconds(5);
-// bool b = hstart == mend;
-// system_clock::time_point sstart = system_clock::now();
-// std::cout << "Subtracting system_clock::time_point from monotonic_clock::time_point doesn't compile\n";
-//// mend - sstart; // doesn't compile
-// std::cout << "subtract high_resolution_clock::time_point from monotonic_clock::time_point"
-// " and add that to a system_clock::time_point\n";
-// system_clock::time_point send = sstart + duration_cast<system_clock::duration>(mend - hstart);
-// std::cout << "subtract two system_clock::time_point's and output that in microseconds:\n";
-// microseconds ms = send - sstart;
-// std::cout << ms.count() << " microseconds\n";
-//}
-//
-//void test_c_mapping()
-//{
-// std::cout << "C map test\n";
-// using namespace boost::chrono;
-// system_clock::time_point t1 = system_clock::now();
-// std::time_t c_time = system_clock::to_time_t(t1);
-// std::tm* tmptr = std::localtime(&c_time);
-// std::cout << "It is now " << tmptr->tm_hour << ':' << tmptr->tm_min << ':' << tmptr->tm_sec << ' '
-// << tmptr->tm_year + 1900 << '-' << tmptr->tm_mon + 1 << '-' << tmptr->tm_mday << '\n';
-// c_time = std::mktime(tmptr);
-// system_clock::time_point t2 = system_clock::from_time_t(c_time);
-// microseconds ms = t1 - t2;
-// std::cout << "Round-tripping through the C interface truncated the precision by " << ms.count() << " microseconds\n";
-//}
-
-
-int main()
-{
- test_system_clock();
- test_monotonic_clock();
- test_hi_resolution_clock();
- //test_mixed_clock();
- return 0;
-}
-


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