Skip to content

Commit 448b198

Browse files
author
Colin Robertson
authored
Merge pull request MicrosoftDocs#3225 from MicrosoftDocs/master637604991402649583
Repo sync for protected CLA branch
2 parents bee564d + 017c4ef commit 448b198

18 files changed

+1359
-169
lines changed

docs/standard-library/chrono-functions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
description: "Learn more about: <chrono> functions"
33
title: "<chrono> functions"
44
ms.date: 6/16/2021
5-
f1_keywords: ["chrono/std::duration_cast", "chrono/std::time_point_cast", "chrono/std::from_stream", "chrono/std::chrono::duration_cast", "chrono/std::chrono::time_point_cast", "chrono/std::chrono::from_stream", "chrono/std::chrono::floor", "chrono/std::chrono::ceil", "chrono/std::chrono::round", "chrono/std::chrono::is_am", "chrono/std::chrono::is_pm", "chrono/std::chrono::make12", "chrono/std::chrono::make24", "chrono/std::chrono::get_leap_second_info", "chrono/std::chrono::get_tzdb", "chrono/std::chrono::get_tzdb_list", "chrono/std::chrono::locate_zone", "chrono/std::chrono::current_zone", "chrono/std::chrono::reload_tzdb", "chrono/std::chrono::remote_version"]
5+
f1_keywords: ["chrono/std::duration_cast", "chrono/std::time_point_cast", "chrono/std::chrono::duration_cast", "chrono/std::chrono::time_point_cast", "chrono/std::chrono::from_stream", "chrono/std::chrono::floor", "chrono/std::chrono::ceil", "chrono/std::chrono::round", "chrono/std::chrono::is_am", "chrono/std::chrono::is_pm", "chrono/std::chrono::make12", "chrono/std::chrono::make24", "chrono/std::chrono::get_leap_second_info", "chrono/std::chrono::get_tzdb", "chrono/std::chrono::get_tzdb_list", "chrono/std::chrono::locate_zone", "chrono/std::chrono::current_zone", "chrono/std::chrono::reload_tzdb", "chrono/std::chrono::remote_version"]
66
helpviewer_keywords: ["std::duration_cast function", "std::time_point_cast function", "std::chrono::duration_cast function", "std::chrono::time_point_cast function", "std::chrono::from_stream function", "std::chrono::floor function", "std::chrono::ceil function", "std::chrono::round function", "std::chrono::is_am function", "std::chrono::is_pm function", "std::chrono::make12 function", "std::chrono::make24 function", "std::chrono::get_leap_second_info function", "std::chrono::get_tzdb function", "std::chrono::get_tzdb_list function", "std::chrono::locate_zone function", "std::chrono::current_zone function", "std::chrono::reload_tzdb function", "std::chrono::remote_version function"]
77
---
88

docs/standard-library/chrono-operators.md

Lines changed: 303 additions & 91 deletions
Large diffs are not rendered by default.

docs/standard-library/chrono.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@ Beginning in Visual Studio 2015, the implementation of `steady_clock` has change
3939
| [`year` class](../standard-library/year-class.md) | A year in the [Gregorian calendar](https://en.wikipedia.org/wiki/Proleptic_Gregorian_calendar).|
4040
| [`year_month` class](../standard-library/year-month-class.md) | A year and month. The day isn't specified.|
4141
| [`year_month_day` class](../standard-library/year-month-day-class.md) | A year, month, and day.|
42+
| [`year_month_day_last` class](../standard-library/year-month-day-last-class.md) | The last day of a specific month and year. |
43+
| [`year_month_weekday` class](../standard-library/year-month-weekday-class.md) | A specific year, month, and nth weekday of the month. |
44+
| [`year_month_weekday_last` class](../standard-library/year-month-weekday-last-class.md) | A specific year, month, and last weekday of the month. |
4245

4346
### Structs
4447

docs/standard-library/month-class.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
description: "Learn more about: month Class"
33
title: "month class"
4-
ms.date: "04/26/2021"
4+
ms.date: "6/25/2021"
55
f1_keywords: ["chrono/std::chrono::month", "chrono/std::chrono::month::January", "chrono/std::chrono::month::February", "chrono/std::chrono::month::March","chrono/std::chrono::month::April","chrono/std::chrono::month::May","chrono/std::chrono::month::June","chrono/std::chrono::month::July","chrono/std::chrono::month::August","chrono/std::chrono::month::September","chrono/std::chrono::month::October","chrono/std::chrono::month::November","chrono/std::chrono::month::December","chrono/std::chrono::month::operator++", "chrono/std::chrono::month::operator--", "chrono/std::chrono::month::operator unsigned", "chrono/std::chrono::month::ok"]
66
helpviewer_keywords: ["std::chrono [C++], month"]
77
---
@@ -107,7 +107,7 @@ using namespace std::chrono;
107107

108108
int main()
109109
{
110-
month m{1};
110+
month m{January};
111111

112112
std::cout << m << " " << ++m << "\n"; // constexpr month& operator++() noexcept
113113
std::cout << m << " " << m++ << "\n"; // constexpr month operator++(int) noexcept
@@ -153,7 +153,7 @@ using namespace std::chrono;
153153

154154
int main()
155155
{
156-
std::chrono::month m{5};
156+
month m{May};
157157

158158
cout << m << " " << --m << "\n"; // constexpr month& operator++() noexcept
159159
cout << m << " " << m-- << "\n"; // constexpr month operator++(int) noexcept

docs/standard-library/month-day-class.md

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
description: "Learn more about: month_day Class"
33
title: "month_day class"
4-
ms.date: "6/4/2021"
4+
ms.date: "6/25/2021"
55
f1_keywords: ["chrono/std::chrono::month_day", "chrono/std::chrono::month_day::day", "chrono/std::chrono::month_day::month", "chrono/std::chrono::month_day::ok"]
66
helpviewer_keywords: ["std::chrono [C++], month_day"]
77
---
@@ -75,19 +75,17 @@ using namespace std::chrono;
7575
7676
int main()
7777
{
78-
month m(7);
79-
day d(30);
80-
month_day md(m, d);
78+
month_day md(30d/July);
79+
month_day md2 = July/30; // another way to construct a month_day
8180
82-
month_day md2 = July/30; // a convenient way to construct a month_day
83-
84-
std::cout << md << ' ' << md2;
81+
std::cout << md << '\n' << md2;
8582
return 0;
8683
}
8784
```
8885

8986
```output
90-
Jul/30 Jul/30
87+
Jul/30
88+
Jul/30
9189
```
9290

9391
## <a name="day"></a> `day`

docs/standard-library/month-day-last-class.md

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
description: "Learn more about: month_day_last Class"
33
title: "month_day_last class"
4-
ms.date: "06/04/2021"
4+
ms.date: "06/25/2021"
55
f1_keywords: ["chrono/std::chrono::month_day_last", "chrono/std::chrono::month_day_last::month", "chrono/std::chrono::month_day_last::ok"]
66
helpviewer_keywords: ["std::chrono [C++], month_day_last"]
77
---
@@ -63,13 +63,17 @@ using namespace std::chrono;
6363
6464
int main()
6565
{
66-
month_day_last mdl = month_day_last(month(10));
67-
68-
// a convenient way to create a month_day_last
69-
month_day_last mdl2 {October / last };
66+
month_day_last mdl{ October / last };
67+
std::cout << mdl;
68+
69+
return 0;
7070
}
7171
```
7272

73+
```output
74+
Oct/last
75+
```
76+
7377
## <a name="month"></a> `month`
7478

7579
Return the month value.

docs/standard-library/month-weekday-class.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
description: "Learn more about: month_weekday Class"
33
title: "month_weekday class"
4-
ms.date: "06/4/2021"
4+
ms.date: "06/25/2021"
55
f1_keywords: ["chrono/std::chrono::month_weekday", "chrono/std::chrono::month_weekday::weekday", "chrono/std::chrono::month_weekday::month", "chrono/std::chrono::month_weekday::ok", "chrono/std::chrono::month_weekday::weekday_indexed"]
66
helpviewer_keywords: ["std::chrono [C++], month_weekday"]
77
---
@@ -72,14 +72,13 @@ using namespace std::chrono;
7272
7373
int main()
7474
{
75-
constexpr auto wdi = weekday_indexed(Monday, 1);
76-
constexpr auto month = July;
77-
month_weekday mw(month, wdi);
75+
month_weekday mw{ July/Monday[1] };
7876
std::cout << mw << '\n';
7977
80-
// A convenient way to create a month_weekday
78+
// Another way to create a month_weekday
8179
month_weekday mw2 = February / Tuesday[3];
8280
std::cout << mw2;
81+
8382
return 0;
8483
}
8584
```

docs/standard-library/month-weekday-last-class.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
description: "Learn more about: month_weekday_last Class"
33
title: "month_weekday_last class"
4-
ms.date: "5/21/2021"
4+
ms.date: "6/25/2021"
55
f1_keywords: ["chrono/std::chrono::month_weekday_last", "chrono/std::chrono::month_weekday_last::ok", "std::chrono::month_weekday_last::month_weekday_last", "chrono/std::chrono::month_weekday_last::ok", "chrono/std::chrono::month_weekday_last::month"]
66
helpviewer_keywords: ["std::chrono [C++], month_weekday_last"]
77
---
@@ -71,7 +71,7 @@ using namespace std::chrono;
7171
7272
int main()
7373
{
74-
constexpr auto mwdl = January/Monday[last]; // wdl is the last Monday of January of an unspecified year
74+
constexpr auto mwdl{ January / Monday[last] }; // wdl is the last Monday of January of an unspecified year
7575
std::cout << mwdl << "\n";
7676
7777
const auto theMonth = August;

docs/standard-library/toc.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,12 @@
194194
href: year-month-class.md
195195
- name: year_month_day class
196196
href: year-month-day-class.md
197+
- name: year_month_day_last class
198+
href: year-month-day-last-class.md
199+
- name: year_month_weekday class
200+
href: year-month-weekday-class.md
201+
- name: year_month_weekday_last class
202+
href: year-month-weekday-last-class.md
197203
- name: <cinttypes>
198204
href: ../standard-library/cinttypes.md
199205
- name: <ciso646>

docs/standard-library/weekday-class.md

Lines changed: 31 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
description: "Learn more about: weekday Class"
33
title: "weekday class"
4-
ms.date: "04/28/2021"
4+
ms.date: "6/25/2021"
55
f1_keywords: ["chrono/std::chrono::weekday", "chrono/std::chrono::weekday::January", "chrono/std::chrono::weekday::February", "chrono/std::chrono::weekday::March","chrono/std::chrono::weekday::April","chrono/std::chrono::weekday::May","chrono/std::chrono::weekday::June","chrono/std::chrono::weekday::July","chrono/std::chrono::weekday::August","chrono/std::chrono::weekday::September","chrono/std::chrono::weekday::October","chrono/std::chrono::weekday::November","chrono/std::chrono::weekday::December","chrono/std::chrono::weekday::operator++", "chrono/std::chrono::weekday::operator--", "chrono/std::chrono::weekday::operator unsigned", "chrono/std::chrono::weekday::ok", "chrono/std::chrono::weekday::iso_encoding", "chrono/std::chrono::weekday::c_encoding"]
66
helpviewer_keywords: ["std::chrono [C++], weekday"]
77
---
@@ -78,6 +78,30 @@ Construct a `weekday` with value *`wd`*.
7878
3\) Computes what day of the week corresponds to the `std::chrono::sys_days` value `dp`, and constructs a `weekday` using that day.\
7979
4\) Computes the day of the week that corresponds to the `std::chrono::local_days` value `dp`, and constructs a `weekday` using that day. It behaves as if you created the `weekday` using `weekday(std::chrono::sys_days(dp.time_since_epoch()))`.
8080
81+
### Example: Create a `weekday`
82+
83+
```cpp
84+
// compile using: /std:c++latest
85+
#include <iostream>
86+
#include <chrono>
87+
88+
using namespace std::chrono;
89+
90+
int main()
91+
{
92+
weekday wd{ Wednesday };
93+
weekday wd2{ 3 };
94+
std::cout << wd << '\n' << wd2;
95+
96+
return 0;
97+
}
98+
```
99+
100+
```output
101+
Wednesday
102+
Wednesday
103+
```
104+
81105
## <a name="c_encoding"></a> `c_encoding`
82106

83107
```cpp
@@ -138,17 +162,16 @@ using namespace std::chrono;
138162

139163
int main()
140164
{
141-
std::chrono::weekday y{4};
165+
std::chrono::weekday wd{Thursday};
142166

143-
std::cout << y << " " << ++y << "\n"; // constexpr weekday& operator++() noexcept
144-
std::cout << y << " " << y++ << "\n"; // constexpr weekday operator++(int) noexcept
145-
std::cout << y << "\n";
167+
std::cout << wd << " " << ++wd << "\n"; // constexpr weekday& operator++() noexcept
168+
std::cout << wd << " " << wd++ << "\n"; // constexpr weekday operator++(int) noexcept
169+
std::cout << wd << "\n";
146170

147171
return 0;
148172
}
149173
```
150174

151-
Output:
152175
```output
153176
Thu Fri
154177
Fri Fri
@@ -185,7 +208,7 @@ using namespace std::chrono;
185208

186209
int main()
187210
{
188-
weekday y = weekday{4};
211+
weekday y = weekday{Thursday};
189212

190213
cout << y << " " << --y << "\n"; // constexpr weekday& operator--() noexcept
191214
cout << y << " " << y-- << "\n"; // constexpr weekday operator--(int) noexcept
@@ -195,8 +218,6 @@ int main()
195218
}
196219
```
197220

198-
Output:
199-
200221
```output
201222
Thu Wed
202223
Wed Wed
@@ -267,7 +288,7 @@ using namespace std::chrono;
267288

268289
int main()
269290
{
270-
constexpr auto firstMondayInJanuary =
291+
constexpr auto firstMondayInJanuary =
271292
year_month_day{ Monday[2] / January / 2021y };
272293

273294
std::cout << firstMondayInJanuary << "\n";

docs/standard-library/weekdayindexed-class.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
description: "Learn more about: weekday_indexed Class"
33
title: "weekday_indexed class"
4-
ms.date: "06/07/2021"
4+
ms.date: "06/25/2021"
55
f1_keywords: ["chrono/std::chrono::weekday_indexed", "chrono/std::chrono::weekday_indexed::ok", "std::chrono::weekday_indexed::weekday", "std::chrono::weekday_indexed::ok"]
66
helpviewer_keywords: ["std::chrono [C++], weekday_indexed"]
77
---
@@ -69,7 +69,7 @@ using namespace std::chrono;
6969
7070
int main()
7171
{
72-
constexpr auto wdi = weekday_indexed(Monday, 1);
72+
constexpr auto wdi = weekday_indexed{Monday, 1};
7373
7474
std::cout << wdi;
7575
return 0;
@@ -113,7 +113,7 @@ The weekday value.
113113

114114
int main()
115115
{
116-
constexpr auto wdi = weekday_indexed(Monday, 1);
116+
constexpr auto wdi = weekday_indexed{ Monday, 1 };
117117
std::cout << wdi << "\n";
118118

119119
return 0;

docs/standard-library/weekdaylast-class.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
description: "Learn more about: weekday_last Class"
33
title: "weekday_last class"
4-
ms.date: "06/07/2021"
4+
ms.date: "06/25/2021"
55
f1_keywords: ["chrono/std::chrono::weekday_last", "chrono/std::chrono::weekday_last::ok", "std::chrono::weekday_last::weekday", "chrono/std::chrono::weekday_last::ok", "chrono/std::chrono::weekday_last::weekday"]
66
helpviewer_keywords: ["std::chrono [C++], weekday_last"]
77
---
@@ -103,17 +103,15 @@ using namespace std::chrono;
103103

104104
int main()
105105
{
106-
constexpr auto wdl = Monday[last]; // lastWeekday is the last Monday of an unspecified month
106+
constexpr auto wdl{ Monday[last] }; // wdl is the last Monday of an unspecified month
107107
std::cout << wdl.weekday() << "\n";
108108

109109
return 0;
110110
}
111111
```
112112

113-
Output:
114-
115113
```output
116-
Monday
114+
Mon
117115
```
118116

119117
## See also

docs/standard-library/year-class.md

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
description: "Learn more about: year Class"
33
title: "year class"
4-
ms.date: "06/07/2021"
4+
ms.date: "06/25/2021"
55
f1_keywords: ["chrono/std::chrono::year", "chrono/std::chrono::year::operator++", "chrono/std::chrono::year::operator--", "chrono/std::chrono::year::operator+=", "chrono/std::chrono::year::operator-=", "chrono/std::chrono::year::operator int", "chrono/std::chrono::year::is_leap", "chrono/std::chrono::year::max", "chrono/std::chrono::min", "chrono/std::chrono::year::ok"]
66
helpviewer_keywords: ["std::chrono [C++], year"]
77
---
@@ -78,6 +78,7 @@ Construct a `year` with value *`y`*.
7878
### Example: Create a `year`
7979
8080
```cpp
81+
// compile using: /std:c++latest
8182
#include <iostream>
8283
#include <chrono>
8384
@@ -160,6 +161,7 @@ Returns `*this`
160161
### Example: unary `operator+`
161162

162163
```cpp
164+
// compile using: /std:c++latest
163165
#include <iostream>
164166
#include <chrono>
165167

@@ -196,6 +198,7 @@ Add 1 to the year value.
196198
### Example: `operator++`
197199

198200
```cpp
201+
// compile using: /std:c++latest
199202
#include <iostream>
200203
#include <chrono>
201204

@@ -237,6 +240,7 @@ Returns a negated copy of the `year`.
237240
### Example: unary `operator-`
238241

239242
```cpp
243+
// compile using: /std:c++latest
240244
#include <iostream>
241245
#include <chrono>
242246

@@ -274,6 +278,7 @@ Subtract 1 from the year value.
274278
### Example: `operator--`
275279

276280
```cpp
281+
// compile using: /std:c++latest
277282
#include <iostream>
278283
#include <chrono>
279284

@@ -335,7 +340,6 @@ The number of years to subtract.
335340

336341
`*this`. If the decremented result is less than -32768, it's set to 32767.
337342

338-
339343
## <a name="op_int"></a> `operator int`
340344

341345
Get the `year` value.
@@ -351,7 +355,9 @@ The value of the `year`
351355
### Example: `operator int()`
352356

353357
```cpp
354-
#include <iostream>
358+
// compile using: /std:c++latest
359+
360+
#include <iostream>
355361
#include <chrono>
356362

357363
using namespace std::chrono;
@@ -374,5 +380,8 @@ int main()
374380

375381
[`year_month`](year-month-class.md)\
376382
[`year_month_day`](year-month-day-class.md)\
383+
[`year_month_day_last`](year-month-day-last-class.md)\
384+
[`year_month_weekday`](year-month-weekday-class.md)\
385+
[`year_month_weekday_last`](year-month-weekday-last-class.md)\
377386
[`<chrono>`](chrono.md)\
378387
[Header Files Reference](cpp-standard-library-header-files.md)

0 commit comments

Comments
 (0)