Skip to content

Commit f40afb4

Browse files
authored
Merge pull request #5816 from Rageking8/resolve-mistakes-and-clean-up-chrono-operators-reference
Resolve mistakes and clean up "`<chrono>` operators" reference
2 parents b63732b + abc9008 commit f40afb4

File tree

1 file changed

+25
-25
lines changed

1 file changed

+25
-25
lines changed

docs/standard-library/chrono-operators.md

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ Addition operator for the following types:
2323
- [`year_month_weekday_last`](year-month-weekday-last-class.md)
2424

2525
```cpp
26-
1)
26+
1)
2727
template <class Rep1, class Period1, class Rep2, class Period2>
2828
constexpr typename common_type<duration<Rep1, Period1>, duration<Rep2, Period2>>::type
2929
operator+(
@@ -46,7 +46,7 @@ time_point<Clock, constexpr typename common_type<duration<Rep1, Period1>, Durati
4646

4747
4)
4848
constexpr day operator+(const day& d, const days& ds) noexcept; // C++20
49-
constexpr day operator+(const days& ds, const day& d) noexcept; // C++20
49+
constexpr day operator+(const days& ds, const day& d) noexcept; // C++20
5050

5151
5)
5252
constexpr month operator+(const month& m, const months& ms) noexcept; // C++20
@@ -107,7 +107,7 @@ constexpr year_month_weekday_last operator+(const years& dy, const year_month_we
107107
108108
2-3\) Return a `time_point` object that represents a point in time that is displaced by the interval *`Dur`* from the point in time *`Time`*.
109109
110-
4\) Returns the result of `d+ds.count()`. If the result is out of the range [0, 255], then the result is unspecified.
110+
4\) Returns the result of `d+ds.count()`. If the result is out of the range [0, 255], then the result is unspecified.
111111
112112
5\) Returns the result of `m+ms.count()`. If the result is out of the range [1, 12], it's reduced modulo 12 and then +1.
113113
@@ -117,13 +117,13 @@ constexpr year_month_weekday_last operator+(const years& dy, const year_month_we
117117
118118
8\) Returns the result of adding the number of months and years to the specified month and year.
119119
120-
9\) Returns the result of adding months or years to a `year_month_day`. If `ymd.month()` is `February` and `ymd.day()` is not in the range [1d, 28d], `ok()` may return `false` for the result of the addition.
120+
9\) Returns the result of adding months or years to a `year_month_day`. If `ymd.month()` is `February` and `ymd.day()` is not in the range [1d, 28d], `ok()` may return `false` for the result of the addition.
121121
122122
10\) Returns `(ymdl.year() / ymdl.month() + dm) / last`. Note: The `/` used here isn't a division operator. It's the date operator.
123123
124124
11\) Returns `ymdl + dm`.
125125
126-
12\) Returns `{ymdl.year()+dy, ymdl.month_day_last()}`
126+
12\) Returns `{ymdl.year()+dy, ymdl.month_day_last()}`
127127
128128
13\) Returns `ymwd + dm.count()`.
129129
@@ -163,12 +163,12 @@ int main()
163163
// year_month_weekday
164164
year_month_weekday ymw{ year(1997) / January / Wednesday[1] };
165165
std::cout << ymw + months{1} << '\n'; // 1997/Feb/Wed[1]
166-
std::cout << ymw + years{1} << '\n'; // 1998/Jan/Wed[1]
166+
std::cout << ymw + years{1} << '\n'; // 1998/Jan/Wed[1]
167167
168168
// year_month_weekday_last
169169
year_month_weekday_last ymwl{ year(1997) / January / Wednesday[last] };
170170
std::cout << ymwl + months{ 1 } << '\n'; // 1997/Feb/Wed[last]
171-
std::cout << ymwl + years{ 1 } << '\n'; // 1998/Jan/Wed[last]
171+
std::cout << ymwl + years{ 1 } << '\n'; // 1998/Jan/Wed[last]
172172
173173
return 0;
174174
}
@@ -295,15 +295,15 @@ constexpr year_month_weekday_last operator-(const year_month_weekday_last& ymwdl
295295
296296
4\) Returns the result of `d-ds.count()`. If the result is out of the range [0, 255], then the result is unspecified.
297297
298-
5\) If `m.ok() == true` and `ms.ok() == true`, returns the result of subtracting the two month values, or subtracting the number of months. The result will be in the range [1, 12]. If the result is negative, it wraps around. For example, subtracting one month from January (`month m1{1} - months{1};` results in 12 (December).
298+
5\) If `m.ok() == true` and `ms.ok() == true`, returns the result of subtracting the two month values, or subtracting the number of months. The result will be in the range [1, 12]. If the result is negative, it wraps around. For example, subtracting one month from January (`month m1{1} - months{1};` results in 12 (December).
299299
300300
6\) Returns the difference in months between *`Left`* and *`Right`*
301301
302302
7\) If `Left.ok() == true` and `Right.ok() == true`, returns a `weekday` in the range [`days{0}`, `days{6}`].
303303
304304
8\) Returns the number of days between two weekdays.
305305
306-
9\) Returns `year(int(y)-ys.count)())`
306+
9\) Returns `year(int(y)-ys.count())`
307307
308308
10\) Returns `years(int(y) - int(y2))`. Subtracting two `year` values results in a `std::chrono::years`, which represents the difference in years between `y` and `y2`. For example, `2021y-2000y` produces `years(21)`.
309309
@@ -336,10 +336,10 @@ int main()
336336
{
337337
// day
338338
day d{10};
339-
d = d - days(5);
339+
d = d - days(5);
340340
std::cout << d << '\n'; // 05
341341
342-
// month
342+
// month
343343
month m{2};
344344
m = m - months{1};
345345
std::cout << m << '\n'; // Jan
@@ -362,18 +362,18 @@ int main()
362362
363363
// year_month_day_last
364364
year_month_day_last ymdl = June / last / 2021;
365-
std::cout << ymdl - years{1} - months{1} << '\n'; // 2022/Jul/last
365+
std::cout << ymdl - years{1} - months{1} << '\n'; // 2020/May/last
366366
367367
// year_month_weekday
368368
year_month_weekday ymw{ year(1997) / January / Wednesday[1] };
369369
std::cout << ymw - months{1} << '\n'; // 1996/Dec/Wed[1]
370-
std::cout << ymw - years{1} << '\n'; // 1996/Jan/Wed[1]
370+
std::cout << ymw - years{1} << '\n'; // 1996/Jan/Wed[1]
371371
372372
// year_month_weekday_last
373373
year_month_weekday_last ymwl{ year(1997) / January / Wednesday[last] };
374374
std::cout << ymwl - months{ 1 } << '\n'; // 1996/Dec/Wed[last]
375375
std::cout << ymwl - years{ 1 } << '\n'; // 1996/Jan/Wed[last]
376-
376+
377377
return 0;
378378
}
379379
```
@@ -458,7 +458,7 @@ The right `duration` or `time_point` object.
458458
### Return value
459459
460460
1\) Returns **`true`** if the number of ticks for the type common to *`Left`* and *`Right`* aren't equal. Otherwise, returns **`false`**.\
461-
2\) Returns **`true`** if the two [`time_point`](time-point-class.md) objects don't represent the same point in time. Otherwise, returns **`false`**.
461+
2\) Returns **`true`** if the two [`time_point`](time-point-class.md) objects don't represent the same point in time. Otherwise, returns **`false`**.
462462
463463
## <a name="op_star"></a> `operator*`
464464
@@ -644,7 +644,7 @@ constexpr bool operator==(const year_month_day_last& Left, const year_month_day_
644644
// 16) year_month_weekday
645645
constexpr bool operator==(const year_month_weekday& Left, const year_month_weekday& Right) noexcept; // C++20
646646

647-
// 17) year_month_weekday_last
647+
// 17) year_month_weekday_last
648648
constexpr bool operator==(const year_month_weekday_last& Left, const year_month_weekday_last& Right) noexcept; // C++20
649649

650650
// 18) time_zone_link
@@ -669,7 +669,7 @@ The right object to compare.
669669
2\) Returns **`true`** if *`Left`* and *`Right`* represent the same point in time. Otherwise, returns **`false`**.\
670670
3-17\) Returns **`true`** if *`Left`* and *`Right`* have the same value. Otherwise, returns **`false`**.\
671671
18\) Returns **`true`** if `Left.name() == Right.name()`. Otherwise, returns **`false`**.\
672-
19\) Returns **`true`** if `Left.get_time_zone() == _Right.get_time_zone() && Left.get_sys_time() == Right.get_sys_time();`
672+
19\) Returns **`true`** if `Left.get_time_zone() == Right.get_time_zone() && Left.get_sys_time() == Right.get_sys_time();`
673673
674674
## <a name="op_gt"></a> `operator>`
675675
@@ -678,7 +678,7 @@ The right object to compare.
678678
2\) Determines if the point in time since the epoch of the `Left`[`time_point`](../standard-library/time-point-class.md) is greater than the time since the epoch of the `time_point` in `Right`.
679679
680680
```cpp
681-
1)
681+
1)
682682
template <class Rep1, class Period1, class Rep2, class Period2>
683683
constexpr bool operator>(
684684
const duration<Rep1, Period1>& Left,
@@ -846,8 +846,8 @@ int main()
846846
```
847847

848848
```output
849-
d1 < d2
850-
true true false
849+
d1 > d2
850+
true true false
851851
```
852852

853853
## <a name="op_left_shift"></a> `operator<<`
@@ -1118,7 +1118,7 @@ The output stream you passed in, `os`
11181118
11191119
21\) In Microsoft's implementation, a `sys_info` is output as its `begin`, `end`, `offset`, `save`, and `abbrev` fields. For example: `begin: 2021-03-14 10:00:00, end: 2021-11-07 09:00:00, offset: -25200s, save: 60min, abbrev: PDT`
11201120
1121-
22\) In Microsoft's implementation, a `local_info` is output as yyyy-mm-dd hh:mm::ss.ssssss. For example, `2021-09-17 13:55:59.6590120`
1121+
22\) In Microsoft's implementation, a `local_info` is output as yyyy-mm-dd hh:mm:ss.ssssss. For example, `2021-09-17 13:55:59.6590120`
11221122
11231123
23\) The local time in the `zoned_time` (obtained as `zt.get_local_time()`) is output using the format yyyy-mm-dd hh:mm:ss timezone. For example, `2021-09-15 10:45:00 GMT-6`
11241124
@@ -1160,7 +1160,7 @@ constexpr duration<Rep1, Period1, Rep2>::type
11601160

11611161
2)
11621162
template <class Rep1, class Period1, class Rep2, class Period2>
1163-
constexpr typename common_type<duration<Rep1, _Period1>, duration<Rep2, Period2>>::type
1163+
constexpr typename common_type<duration<Rep1, Period1>, duration<Rep2, Period2>>::type
11641164
operator%(
11651165
const duration<Rep1, Period1>& Left,
11661166
const duration<Rep2, Period2>& Right);
@@ -1214,7 +1214,7 @@ A `duration` object.
12141214
*`Div`*\
12151215
An integral value.
12161216

1217-
*`Left`*\w
1217+
*`Left`*\
12181218
The left `duration` object.
12191219

12201220
*`Right`*\
@@ -1262,7 +1262,7 @@ operator/(const year& y, const month& m) noexcept; // C++20
12621262
// 2
12631263
constexpr year_month
12641264
operator/(const year& y, int m) noexcept; // C++20
1265-
1265+
12661266
///////// returns month_day
12671267

12681268
// 3
@@ -1438,7 +1438,7 @@ operator/(const month_weekday_last& mwdl, int y) noexcept; // C++20
14381438
The day. Provided either as an integer in the range [1,31], or as a [`day`](day-class.md).
14391439

14401440
*`lastspec`*\
1441-
An empty tag type that indicates the last item in s sequence. For example, `2021y/May/last` is the last day of May 2021.
1441+
An empty tag type that indicates the last item in a sequence. For example, `2021y/May/last` is the last day of May 2021.
14421442

14431443
*`m`*\
14441444
The month. Provided either as an integer in the range [1,12], or as a [`month`](month-class.md).

0 commit comments

Comments
 (0)