1 /* $Id: test_boost_time.cpp,v 1.11 2007-05-09 21:23:09 adam Exp $
2 Copyright (c) 2005-2007, Index Data.
4 This file is part of Metaproxy.
6 Metaproxy is free software; you can redistribute it and/or modify it under
7 the terms of the GNU General Public License as published by the Free
8 Software Foundation; either version 2, or (at your option) any later
11 Metaproxy is distributed in the hope that it will be useful, but WITHOUT ANY
12 WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16 You should have received a copy of the GNU General Public License
17 along with Metaproxy; see the file LICENSE. If not, write to the
18 Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
25 #include "boost/date_time/posix_time/posix_time.hpp"
27 #define BOOST_AUTO_TEST_MAIN
28 #include <boost/test/auto_unit_test.hpp>
30 using namespace boost::unit_test;
34 BOOST_AUTO_UNIT_TEST( testboosttime1 )
40 boost::posix_time::ptime now
41 = boost::posix_time::microsec_clock::local_time();
42 //std::cout << now << std::endl;
46 boost::posix_time::ptime then
47 = boost::posix_time::microsec_clock::local_time();
48 //std::cout << then << std::endl;
50 boost::posix_time::time_period period(now, then);
51 //std::cout << period << std::endl;
53 boost::posix_time::time_duration duration = then - now;
54 //std::cout << duration << std::endl;
56 BOOST_CHECK (duration.total_seconds() >= 1);
57 BOOST_CHECK (duration.fractional_seconds() > 0);
60 catch (std::exception &e) {
61 std::cout << e.what() << "\n";
72 * indent-tabs-mode: nil
73 * c-file-style: "stroustrup"
75 * vim: shiftwidth=4 tabstop=8 expandtab