File: testclocks.cpp

package info (click to toggle)
boost 1.32.0-6
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 93,952 kB
  • ctags: 128,458
  • sloc: cpp: 492,477; xml: 52,125; python: 13,519; ansic: 13,013; sh: 1,773; yacc: 853; makefile: 526; perl: 418; lex: 110; csh: 6
file content (29 lines) | stat: -rw-r--r-- 976 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
/* Copyright (c) 2003-2004 CrystalClear Software, Inc.
 * Subject to the Boost Software License, Version 1.0. 
 * (See accompanying file LICENSE-1.0 or http://www.boost.org/LICENSE-1.0)
 * Author: Jeff Garland, Bart Garst
 * $Date: 2004/10/13 18:56:29 $
 */

#include "boost/date_time/local_time/local_time.hpp"
#include <iostream>

int
main()
{
  using namespace boost::gregorian;
  using namespace boost::posix_time;
  using namespace boost::local_time;

  typedef boost::date_time::second_clock<date, local_date_time> local_sec_clock;

  boost::shared_ptr<time_zone_base> az_tz(new posix_time_zone("MST-07"));
  boost::shared_ptr<time_zone_base> ny_tz(new posix_time_zone("EST-05EDT,M4.1.0,M10.5.0"));
  ptime tl = second_clock::local_time();
  local_date_time ldt1 = local_sec_clock::local_time(az_tz);
  std::cout << ldt1.to_string() << std::endl;
  local_date_time ldt2 = local_sec_clock::local_time(ny_tz);
  std::cout << ldt2.to_string() << std::endl;

   return 0;
}