• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* Copyright (c) 2002,2003 CrystalClear Software, Inc.
2  * Use, modification and distribution is subject to the
3  * Boost Software License, Version 1.0. (See accompanying
4  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
5  * Author: Jeff Garland
6  */
7 
8 #include <boost/config.hpp>
9 #include "boost/date_time/posix_time/posix_time.hpp"
10 #include <iostream>
11 
12 int
main()13 main()
14 {
15 
16   using namespace boost::posix_time;
17   ptime tl = second_clock::local_time();
18   std::cout << tl << std::endl;
19 
20   ptime tu = second_clock::universal_time();
21   std::cout << tu << std::endl;
22 
23 #if !defined(BOOST_WINDOWS) && defined(_POSIX_TIMERS)
24   for (int i=0; i < 3; ++i) {
25     ptime t2 = second_clock::local_time();
26     std::cout << t2 << std::endl;
27     sleep(1);
28   }
29 #endif
30 
31 #ifdef BOOST_DATE_TIME_HAS_HIGH_PRECISION_CLOCK
32    for (int i=0; i < 10; ++i) {
33      //ptime t2 = high_precision_clock::local_time();
34      ptime t2 = microsec_clock::local_time();
35      std::cout << t2 << std::endl;
36    }
37 #endif // BOOST_DATE_TIME_HAS_HIGH_PRECISION_CLOCK
38 
39   return 0;
40 
41 }
42 
43