3 #include "boost/date_time/posix_time/posix_time.hpp"
5 #define BOOST_AUTO_TEST_MAIN
6 #include <boost/test/auto_unit_test.hpp>
8 using namespace boost::unit_test;
12 BOOST_AUTO_TEST_CASE( testboosttime1 )
18 //using namespace boost::posix_time;
19 //using namespace boost::gregorian;
21 //get the current time from the clock -- one second resolution
22 //boost::posix_time::ptime now = boost::posix_time::second_clock::local_time();
23 boost::posix_time::ptime now = boost::posix_time::microsec_clock::local_time();
24 //std::cout << to_iso_extended_string(now) << std::endl;
25 //std::cout << now << std::endl;
29 boost::posix_time::ptime then = boost::posix_time::microsec_clock::local_time();
31 //std::cout << then << std::endl;
33 boost::posix_time::time_period period(now, then);
35 //std::cout << period << std::endl;
38 //Get the date part out of the time
39 //date today = now.date();
40 //date tommorrow = today + days(1);
41 //ptime tommorrow_start(tommorrow); //midnight
43 //iterator adds by one hour
44 //time_iterator titr(now,hours(1));
45 //for (; titr < tommorrow_start; ++titr) {
46 // std::cout << to_simple_string(*titr) << std::endl;
49 //time_duration remaining = tommorrow_start - now;
50 //std::cout << "Time left till midnight: "
51 // << to_simple_string(remaining) << std::endl;
56 catch (std::exception &e) {
57 std::cout << e.what() << "\n";
68 * indent-tabs-mode: nil
70 * vim: shiftwidth=4 tabstop=8 expandtab