diff --git a/Examples-and-Recipes.md b/Examples-and-Recipes.md index 2454e1f..ef4b3cf 100644 --- a/Examples-and-Recipes.md +++ b/Examples-and-Recipes.md @@ -1623,20 +1623,27 @@ Turns out not hard at all. #include using fortnights = - std::chrono::duration, - date::weeks::period>>; + std::chrono::duration, date::weeks::period>>; using microfortnights = std::chrono::duration>; + constexpr + inline + microfortnights + operator"" _ufn(unsigned long long x) + { + return microfortnights{static_cast(x)}; + } + int main() { using namespace date; using namespace std::chrono; - std::cout << format("%F %T\n", sys_days{nov/29/2016} + 15h + 13min + - microfortnights{35}); + std::cout << format("%F %T\n", sys_days{nov/29/2016} + 15h + 13min + 35_ufn); } The first thing to do is build your `chrono::duration` that represents a `microfortnight`. This is best done by first building a `fortnight`, and then multiplying that by `std::micro`. This will build some weird `chrono::duration` with a period we don't really have to know, but turns out to be not that far off from a second.