]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/date_time/test/local_time/testclocks.cpp
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
8 #include "boost/date_time/local_time/local_time.hpp"
11 // The actual clocks are tested in posix_time/testclock.cpp.
12 // These tests are to verify that the time zone is applied correctly
17 using namespace boost::gregorian
;
18 using namespace boost::posix_time
;
19 using namespace boost::local_time
;
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"));
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
;
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
;