From 7396a889c5a052c733a586a1a462cc15b927430c Mon Sep 17 00:00:00 2001 From: Howard Hinnant Date: Sat, 30 Mar 2019 20:01:14 -0400 Subject: [PATCH] Updated Examples and Recipes (markdown) --- Examples-and-Recipes.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Examples-and-Recipes.md b/Examples-and-Recipes.md index cd2f5eb..2936ba5 100644 --- a/Examples-and-Recipes.md +++ b/Examples-and-Recipes.md @@ -137,7 +137,7 @@ main() { using namespace std::chrono; using namespace date; - zoned_time ny{"America/New_York", local_days{jul/8/2016} + 9h}; + zoned_time ny{"America/New_York", local_days{July/8/2016} + 9h}; zoned_time moscow{"Europe/Moscow", ny}; std::cout << ny << '\n'; std::cout << moscow << '\n'; @@ -154,7 +154,7 @@ Then just print it out: Obviously you could just as easily specify the meeting in Moscow's time zone and then find the equivalent time in New York: ```c++ - zoned_time moscow{"Europe/Moscow", local_days{8_d/jul/2016} + 16h}; + zoned_time moscow{"Europe/Moscow", local_days{8_d/July/2016} + 16h}; zoned_time ny{"America/New_York", moscow}; ``` @@ -163,7 +163,7 @@ This would result in the exact same output. For those paying attention, I reord Sometimes it is convenient to specify the time independent of either timezone. For example this might be some celestial event such as an eclipse. Often such events are recorded in UTC so that people in all time zones can more easily know the correct time. It is just as easy to use UTC for this example: ```c++ - auto utc = sys_days{2016_y/jul/8} + 13h; + auto utc = sys_days{2016_y/July/8} + 13h; zoned_time ny{"America/New_York", utc}; zoned_time moscow{"Europe/Moscow", utc}; ``` @@ -173,7 +173,7 @@ I reordered the date to y/m/d just to show that I could. As long as the first u Instead of `local_days`, `sys_days` is used instead. `sys_days` means UTC (technically it means [Unix Time](https://en.wikipedia.org/wiki/Unix_time) which is a very close approximation to UTC). Then you can construct each `zoned_time` with the UTC time (which has type `sys_time` in this example). You could also construct the second `zoned_time` from the first, just as before: ```c++ - zoned_time ny{"America/New_York", sys_days{jul/8/2016} + 13h}; + zoned_time ny{"America/New_York", sys_days{July/8/2016} + 13h}; zoned_time moscow{"Europe/Moscow", ny}; ```