Updated Boost datetime Examples Translated (markdown)

Howard Hinnant
2016-05-21 13:25:59 -04:00
parent d756bbf889
commit 1d45d16e6f

@@ -408,7 +408,7 @@ If your OS supports the `std::locale("de_DE")` the above can be simplified to:
using namespace date;
// get the current time from the clock -- one second resolution
auto now = floor<seconds>(current_zone()->
to_local(system_clock::now()).first);
to_local(system_clock::now()));
// Get the date part out of the time
auto today = floor<days>(now);
auto tomorrow = today + days{1}; // midnight
@@ -448,7 +448,7 @@ If your OS supports the `std::locale("de_DE")` the above can be simplified to:
auto t2 = zone->to_sys(t1);
std::cout << t1 << " in New York is " << t2 << " UTC time\n";
auto t3 = zone->to_local(t2).first; // back should be the same
auto t3 = zone->to_local(t2); // back should be the same
std::cout << t2 << " UTC is " << t3 << " New York time\n\n";
// 4 hours b/f midnight NY time
@@ -457,7 +457,7 @@ If your OS supports the `std::locale("de_DE")` the above can be simplified to:
auto t5 = zone->to_sys(t4);
std::cout << t4 << " in New York is " << t5 << " UTC time\n";
auto t6 = zone->to_local(t5).first; // back should be the same
auto t6 = zone->to_local(t5); // back should be the same
std::cout << t5 << " UTC is " << t6 << " New York time\n\n";
// Arizona timezone is utc-7 with no dst
@@ -546,10 +546,10 @@ an example using the IANA timezone database see the [Local to UTC Conversion](#L
std::cout << "departure phx time: " << phx_departure << '\n';
std::cout << "arrival phx time: "
<< floor<minutes>(phx_arrival.first)
<< floor<minutes>(phx_arrival)
<< ' ' << phx_arrival.second << '\n';
std::cout << "arrival nyc time: "
<< floor<minutes>(nyc_arrival.first)
<< floor<minutes>(nyc_arrival)
<< ' ' << nyc_arrival.second << '\n';
}