• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* Copyright (c) 2003-2004 CrystalClear Software, Inc.
2  * Subject to the Boost Software License, Version 1.0.
3  * (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
4  * Author: Jeff Garland, Bart Garst
5  * $Date$
6  */
7 
8 #include "boost/date_time/local_time/local_time.hpp"
9 #include <iostream>
10 
11 // The actual clocks are tested in posix_time/testclock.cpp.
12 // These tests are to verify that the time zone is applied correctly
13 
14 int
main()15 main()
16 {
17   using namespace boost::gregorian;
18   using namespace boost::posix_time;
19   using namespace boost::local_time;
20 
21 
22   boost::shared_ptr<time_zone> az_tz(new posix_time_zone("MST-07"));
23   boost::shared_ptr<time_zone> ny_tz(new posix_time_zone("EST-05EDT,M4.1.0,M10.5.0"));
24 
25   ptime tl = second_clock::local_time();
26   std::cout << tl << std::endl;
27   local_date_time ldt1 = local_sec_clock::local_time(az_tz);
28   std::cout << ldt1.to_string() << std::endl;
29   local_date_time ldt2 = local_sec_clock::local_time(ny_tz);
30   std::cout << ldt2.to_string() << std::endl;
31 
32   tl = microsec_clock::local_time();
33   std::cout << tl << std::endl;
34   local_date_time ldt3 = local_microsec_clock::local_time(az_tz);
35   std::cout << ldt3.to_string() << std::endl;
36   local_date_time ldt4 = local_microsec_clock::local_time(ny_tz);
37   std::cout << ldt4.to_string() << std::endl;
38 
39    return 0;
40 }
41