Updated Examples and Recipes (markdown)

Howard Hinnant
2019-03-19 22:52:08 -04:00
parent d9d8bccbe6
commit 15dea341ce

@@ -154,8 +154,8 @@ 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++
auto moscow = make_zoned("Europe/Moscow", local_days{8_d/jul/2016} + 16h);
auto ny = make_zoned("America/New_York", moscow);
zoned_time moscow{"Europe/Moscow", local_days{8_d/jul/2016} + 16h};
zoned_time ny{"America/New_York", moscow};
```
This would result in the exact same output. For those paying attention, I reordered the date from m/d/y to d/m/y just to show that I could. The meaning is the same.
@@ -164,8 +164,8 @@ Sometimes it is convenient to specify the time independent of either timezone.
```c++
auto utc = sys_days{2016_y/jul/8} + 13h;
auto ny = make_zoned("America/New_York", utc);
auto moscow = make_zoned("Europe/Moscow", utc);
zoned_time ny{"America/New_York", utc};
zoned_time moscow{"Europe/Moscow", utc};
```
I reordered the date to y/m/d just to show that I could. As long as the first unit is unambiguous (`year`, `month` or `day`), the following two are unambiguous (only `y/m/d`, `d/m/y` and `m/d/y` are accepted; all others are rejected at compile time).
@@ -173,8 +173,8 @@ 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<hours>` in this example). You could also construct the second `zoned_time` from the first, just as before:
```c++
auto ny = make_zoned("America/New_York", sys_days{jul/8/2016} + 13h);
auto moscow = make_zoned("Europe/Moscow", ny);
zoned_time ny{"America/New_York", sys_days{jul/8/2016} + 13h};
zoned_time moscow{"Europe/Moscow", ny};
```
In any event, the output is still: