diff --git a/Examples-and-Recipes.md b/Examples-and-Recipes.md index 23794be..ec55dda 100644 --- a/Examples-and-Recipes.md +++ b/Examples-and-Recipes.md @@ -320,15 +320,16 @@ This example demonstrates both some simple date arithmetic, and how to handle di using namespace date; // Dave was born April 24, 1954. 10:03 AM pst // Want to know when he is 2 Gigaseconds old - auto birthday = make_zoned("America/Los_Angeles", local_days{apr/24/1954} + 10h + 3min); - std::cout << "born : " << birthday << '\n'; + auto birthday = make_zoned("America/Los_Angeles", + local_days{apr/24/1954} + 10h + 3min); + std::cout << "born : " << birthday << '\n'; birthday = birthday.get_sys_time() + 2'000'000'000s; std::cout << "2Gs birthday: " << birthday << '\n'; } One first creates the local time, and then pairs that to the time zone "America/Los_Angeles" using `make_zoned`. Then add 2Gs to the `sys_time` (not the `local_time`) of `birthday`. This outputs: - born : 1954-04-24 10:03:00 PST + born : 1954-04-24 10:03:00 PST 2Gs birthday: 2017-09-08 14:36:20 PDT Note that without handling the timezone correctly, this result would be an hour off (2017-09-08 13:36:20) because the birth date falls in PST, and the celebration date falls in PDT.