| 186 | } |
| 187 | |
| 188 | void TestLocalTime() |
| 189 | { |
| 190 | using namespace boost::local_time; |
| 191 | using namespace boost::date_time; |
| 192 | //setup some timezones for creating and adjusting times |
| 193 | //first time zone uses the time zone file for regional timezone definitions |
| 194 | tz_database tz_db; |
| 195 | //tz_db.load_from_file("date_time_zonespec.csv"); |
| 196 | time_zone_ptr nyc_tz = tz_db.time_zone_from_region("America/New_York"); |
| 197 | //This timezone uses a posix time zone string definition to create a time zone |
| 198 | posix_time_zone timezone("MST-07:00:00"); |
| 199 | time_zone_ptr phx_tz(new posix_time_zone("MST-07:00:00")); |
| 200 | |
| 201 | //local departure time in phoenix is 11 pm on April 2 2005 |
| 202 | // Note that New York changes to daylight savings on Apr 3 at 2 am) |
| 203 | local_date_time phx_departure(boost::gregorian::date(2005, Apr, 2), boost::posix_time::hours(23), phx_tz, |
| 204 | local_date_time::NOT_DATE_TIME_ON_ERROR); |
| 205 | |
| 206 | boost::posix_time::time_duration flight_length = boost::posix_time::hours(4) + boost::posix_time::minutes(30); |
| 207 | local_date_time phx_arrival = phx_departure + flight_length; |
| 208 | //convert the phx time to a nyz time |
| 209 | local_date_time nyc_arrival = phx_arrival.local_time_in(nyc_tz); |
| 210 | auto tzs = timezone.to_posix_string(); |
| 211 | auto tds = boost::posix_time::to_simple_string(flight_length); |
| 212 | } |
| 213 | |
| 214 | void TestContainers() |
| 215 | { |