From 8f1860b593e794ccdcef4914b791e26fd3eea373 Mon Sep 17 00:00:00 2001 From: HowardHinnant Date: Sat, 1 Aug 2015 20:54:23 -0400 Subject: [PATCH] Updated Examples and Recipes (markdown) --- Examples-and-Recipes.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Examples-and-Recipes.md b/Examples-and-Recipes.md index 0d2d4ab..14798f9 100644 --- a/Examples-and-Recipes.md +++ b/Examples-and-Recipes.md @@ -104,7 +104,7 @@ std::cout << t.tm_year << "-" << t.tm_mon << "-" << t.tm_day << " "; ### Normalizing `y/m/d` when it is `!ok()` (by [Howard Hinnant](https://github.com/HowardHinnant)) -The following function will "normalize" a `year_month_day`, much like `mktime` normalizes a `tm`. This function is not part of the library, but is offered as an example if you find your self needing things like this: +The following function will "normalize" a `year_month_day`, much like `mktime` normalizes a `tm`. This function is not part of the library, but is offered as an example if you find yourself needing things like this: date::year_month_day normalize(date::year_month_day ymd) @@ -115,7 +115,7 @@ The following function will "normalize" a `year_month_day`, much like `mktime` n return ymd; } -The first line simply adds 0 months to the `ymd`. If `ymd.month()` is 0, with will subtract one from the `year` and set the month to `Dec`. If `ymd.month()` is greater than 12, the year will be incremented as many times as appropriate, and the month will be brought within the proper range. This operation will do nothing if `ymd.month().ok()` is already true. +The first line simply adds 0 months to the `ymd`. If `ymd.month()` is 0, this will subtract one from the `year` and set the month to `Dec`. If `ymd.month()` is greater than 12, the year will be incremented as many times as appropriate, and the month will be brought within the proper range. This operation will do nothing if `ymd.month().ok()` is already true. The second line will "normalize" the day field. The second line requires that the month field is already normalized. For example `2015_y/dec/32` will become `2016_y/jan/1`. If the day field is already in range, there will be no change.