From 1db7c3f841908c15f3379125b374a5069813a530 Mon Sep 17 00:00:00 2001 From: Howard Hinnant Date: Mon, 14 May 2018 16:08:18 -0400 Subject: [PATCH] Updated Examples and Recipes (markdown) --- Examples-and-Recipes.md | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/Examples-and-Recipes.md b/Examples-and-Recipes.md index 563cab4..4cef036 100644 --- a/Examples-and-Recipes.md +++ b/Examples-and-Recipes.md @@ -44,7 +44,7 @@ This page contains examples and recipes contributed by community members. Feel f This couldn't be easier: ```c++ -#include "tz.h" +#include "date/tz.h" #include int @@ -70,7 +70,7 @@ Note that the precision of this output is with whatever precision your `system_c If you need to find out the current time where you _aren't_, then that is a simple matter too: ```c++ -#include "tz.h" +#include "date/tz.h" #include int @@ -96,7 +96,7 @@ All IANA timezone names (or links -- aliases to timezones) are supported. Would you just like to know how many hours ahead or behind your friend is in another time zone? Here's how you do that with this library. ```c++ -#include "tz.h" +#include "date/tz.h" #include int @@ -129,7 +129,7 @@ And now the output is: Say you want to set up a video conference between New York and Moscow. This can be done in a few simple ways. First you need to decide when the meeting is going to be with respect to _somebody's_ clock. For example, let's say we want to have the meeting on Jul 8, 2016 at 9am in New York. How do we define that time, and then find the same instant in Moscow? ```c++ -#include "tz.h" +#include "date/tz.h" #include int @@ -503,7 +503,7 @@ This library can query the installed IANA timezone database for its version numb Here is how you get the version of the installed IANA timezone database: ```c++ -#include "tz.h" +#include "date/tz.h" #include int @@ -1081,8 +1081,8 @@ This example demonstrates both some simple date arithmetic, and how to handle di ```c++ #include #include -#include "date.h" -#include "tz.h" +#include "date/date.h" +#include "date/tz.h" int main() @@ -1170,7 +1170,7 @@ It is generally accepted knowledge that doing time point arithmetic in "local ti However this library can be used to correctly do such computations very easily. Below is code that prints out 9am for several days in the "America/New_York", both just before the DST transition, and just after: ```c++ -#include "tz.h" +#include "date/tz.h" #include int @@ -1213,7 +1213,7 @@ First problem: Is `2016-04-03 03:15` a time local to the time zone, or is it UT So we need two `find_by_abbrev`: One which takes a `sys_time`, and one which takes a `local_time`. Let's do `sys_time` first: ```c++ -#include "tz.h" +#include "date/tz.h" #include #include #include @@ -1347,7 +1347,7 @@ How you choose between these time zones is beyond the scope of this library. Pe Let's say you want to search the globe, and all time, for time zones when the daylight savings shift was not 1 hour. Sound strange? Maybe, but this code teaches you how to _efficiently_ iterate over **all** timezone transitions and inspect their characteristics. So you can use this code for all kinds of searches over time zones. ```c++ -#include "tz.h" +#include "date/tz.h" #include int @@ -1411,7 +1411,7 @@ Sample output of this program: Ever wonder how the global use of daylight saving time is trending with time? Here's one way to find out: ```c++ -#include "tz.h" +#include "date/tz.h" #include int @@ -2020,7 +2020,7 @@ Once we have a string of form 2), give this sample code a try (thank you [Aaron] #include #include #include -#include "tz.h" +#include "date/tz.h" int main() { @@ -2058,7 +2058,7 @@ And check if the time zone abbreviation is consistent, and in the ambiguous case #include #include #include -#include "tz.h" +#include "date/tz.h" int main() { @@ -2125,7 +2125,7 @@ If you're dealing with quarter-second durations, or frame-durations of 1/60 seco Turns out not hard at all. ```c++ -#include "date.h" +#include "date/date.h" #include using fortnights = @@ -2171,8 +2171,8 @@ If this library can do this so easily with something as crazy as `microfortnight The library uses the path `~/Downloads` by default. What if you use a different path for your download directory such as `~/Téléchargements` or `~/Завантаження` and you want your program to automatically find this path ? A solution is to use [xdg_user_dir](https://freedesktop.org/wiki/Software/xdg-user-dirs/). The following code shows you how you can do it : ```c++ -#include "date.h" -#include "tz.h" +#include "date/date.h" +#include "date/tz.h" #include #include