Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r67771 - in trunk/libs/chrono: example test
From: vicente.botet_at_[hidden]
Date: 2011-01-08 05:30:34


Author: viboes
Date: 2011-01-08 05:30:31 EST (Sat, 08 Jan 2011)
New Revision: 67771
URL: http://svn.boost.org/trac/boost/changeset/67771

Log:
Boost.Chrono: Added French output example

Added:
   trunk/libs/chrono/example/french.cpp (contents, props changed)
Text files modified:
   trunk/libs/chrono/test/Jamfile.v2 | 1 +
   1 files changed, 1 insertions(+), 0 deletions(-)

Added: trunk/libs/chrono/example/french.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/chrono/example/french.cpp 2011-01-08 05:30:31 EST (Sat, 08 Jan 2011)
@@ -0,0 +1,31 @@
+// french.cpp ----------------------------------------------------------//
+
+// Copyright 2010 Howard Hinnant
+// Copyright 2011 Vicente J. Botet Escriba
+// Distributed under the Boost Software License, Version 1.0.
+// See http://www.boost.org/LICENSE_1_0.txt
+
+// Adapted to Boost from the original Hawards's code
+
+ #include <boost/chrono/chrono_io.hpp>
+ #include <iostream>
+ #include <locale>
+
+ int main()
+ {
+ using namespace std;
+ using namespace boost;
+ using namespace boost::chrono;
+
+ cout.imbue(locale(locale(), new duration_punct<char>
+ (
+ duration_punct<char>::use_long,
+ "secondes", "minutes", "heures",
+ "s", "m", "h"
+ )));
+ hours h(5);
+ minutes m(45);
+ seconds s(15);
+ milliseconds ms(763);
+ cout << h << ", " << m << ", " << s << " et " << ms << '\n';
+ }

Modified: trunk/libs/chrono/test/Jamfile.v2
==============================================================================
--- trunk/libs/chrono/test/Jamfile.v2 (original)
+++ trunk/libs/chrono/test/Jamfile.v2 2011-01-08 05:30:31 EST (Sat, 08 Jan 2011)
@@ -170,6 +170,7 @@
         [ chrono-run ../example/manipulate_clock_object.cpp ]
         [ chrono-run ../example/chrono_accuracy_test.cpp ]
         [ chrono-run ../example/test_thread_clock.cpp ]
+ [ chrono-run ../example/french.cpp ]
         ;
 
 # test-suite "timer"


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