]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/chrono/example/io_ex2.cpp
1 // io_ex2.cpp ----------------------------------------------------------//
3 // Copyright 2010 Howard Hinnant
4 // Copyright 2010 Vicente J. Botet Escriba
6 // Distributed under the Boost Software License, Version 1.0.
7 // See http://www.boost.org/LICENSE_1_0.txt
10 This code was adapted by Vicente J. Botet Escriba from Hinnant's html documentation.
11 Many thanks to Howard for making his code available under the Boost license.
15 #include <boost/chrono/chrono_io.hpp>
17 #include <boost/assert.hpp>
21 using namespace boost::chrono
;
23 std::istringstream
in("5000 milliseconds 4000 ms 3001 ms");
26 BOOST_ASSERT(in
.good());
27 BOOST_ASSERT(d
== seconds(5));
29 BOOST_ASSERT(in
.good());
30 BOOST_ASSERT(d
== seconds(4));
32 BOOST_ASSERT(in
.fail());
33 BOOST_ASSERT(d
== seconds(4));