Skip to content

Commit 33288e0

Browse files
TaojunshenColin RobertsonTylerMSFTopbld15TylerMSFT
authored
9/6/2021 AM Publish (MicrosoftDocs#3759)
* draft * fix code sample (#3676) * fix code sample * acrolinx Co-authored-by: TylerMSFT <Tyler.Whitney@microsoft.com> * document clocks * add tai-clock * Address 3269 typo in warning number (#3680) * Fixed typo: evalution --> evaluation * updates * finish draft of new clocks * acrolinx * Fixed typo: evalution --> evaluation * Bulk Fix - Sentence form for all alt text (#3683) * Updated C/C++ workload name The workload for C/C++ development in VS Build Tools 2019 installer is called 'Desktop development with C++'. * Split out docs by version Add VS2017-specific instructions. * Updated C/C++ workload name The workload for C/C++ development in VS Build Tools 2019 installer is called 'Desktop development with C++'. * Split out docs by version Add VS2017-specific instructions. * Add 16.11 Compiler Warnings C5247 and C5248 (MicrosoftDocs#3689) * Add C5247 and C5248 * Fix link typos * Updates per Xiang Fan review * More wordsmithage * More fix per X.F. * Fix inconsistencies in CMake docs (MicrosoftDocs#3692) * Standard format for CMake docs * Fix markdownlint * More cleanup. * Clean up link issue, acrolinx * Fix more broken things * Undo a change * Add documentation for "unspecified" architecture Add documentation regarding "unspecified" architecture such that it provides an option for someone to ensure that no inherited environment is selected. * Update markdownlint.json file for unordered lists (#3694) Block rule that wants * instead of - to prefix unordered lists, since we've standardized on the latter. Merging on my own recognizance as repo admin. * Clean up documentation for "unspecified" architecture * Markdown quality fixes 1 of N * Markdown quality fixes 2 of N * Markdown quality fixes 3 of N * Markdown quality fixes 4 of N * Markdown quality fixes 5 of N * Markdown quality fixes 6 of N * Markdown quality fixes 7 of N * Markdown quality fixes 8 of N * Markdown quality fixes 9 of N * Markdown quality fixes 10 of N * Undo TN038 * Markdown quality fixes 11 of N * Setting PATH allows DUMPBIN to be executed from the system command prompt. There are multiple DUMPBIN.EXE's in the MSVC folder, but they can be executed if the PATH is set correctly. If this is not true, or undesireable per system design constraints, please clarify otherwise. * Call out toolchains and embedded scenarios * Add link to environment setting instructions * Make more readable * Address cpp-docs 3286 Postfix increment, decrement syntax (MicrosoftDocs#3711) * Address cpp-docs issue 3286 * Fix formatting, final example * Add compiler warning C5243, C5249, C5250 (MicrosoftDocs#3710) * Removing linux and non-windows bullet point * Make clear it's not required to meet all conditions Add "or" to final bullet point * PR review edit, Microsoft style for lists * Make the "unspecified" architecture option more general * Add __SANITIZE_ADDRESS__ to predefined macros page Noticed __SANITIZE_ADDRESS__ was missing from this list. * Add VS version Also note the VS version where __SANITIZE_ADDRESS__ was added in. * Add docs on using existing cache without cmake-server * Fix unescaped <chrono> (MicrosoftDocs#3715) Noticed this while doing other changes. Without being in a code block, <chrono> becomes the html element of the same name. * Address issue 3301 * Create and integrate /Zc:lambda article (#3719) * Create and integrate /Zc:lambda article * Fix conformance topic date * First half of C++20 changes * The other half of the /std:c++20 fixes * Fix link * Update cmake-projects-in-visual-studio.md * Remove duplicate line in build TOC * tech review * fixes * Cleanup per review * Update thread-class.md * Update future-functions.md * Update execution.md * Update execution.md * Update execution.md * Update future-functions.md * Update thread-class.md * Update execution.md * Update future-functions.md * Update thread-class.md * updates per tech review and other * added file_clock * Update execution.md * Update future-functions.md * Update thread-class.md * add gps_clock * update metadata * PR review edit, relative links * PR review edit, relative links * PR review edit, relative link * Fixed typo in bit-functions.md * Further typo fix * finished draft for local_t * acrolinx * Fixed broken links * incorp tech review * update typedef sections * add all related typedefs * fix tables * acrolinx * cleanup * fix links * fix tables * more table cleanup * another fix for tables. error msgs aren't by the error but I think I finally found the issue * one more table fix * typos * typo in code example * Update links to ARM docs (#3735) * Update links to ARM docs * Acrolinx and formatting pass * Acrolinx * Fix locale_t -> _locale_t * Update output-file-stream-member-functions.md Updated some code escapes for localization * Address github issues (MicrosoftDocs#3737) * fix github 3268 code example for Context::Yield() * fixed github #3312 - MFC CWnd::OnMouseHWheel description * Fix for github #3259-clarify change in the UI * acrolinx Co-authored-by: TylerMSFT <Tyler.Whitney@microsoft.com> * Update how-to-convert-standard-string-to-system-string.md Fixing example. ------- cc: @TylerMSFT GitHub Issue: https://github.com/MicrosoftDocs/cpp-docs/issues/2438 * 16.11 Add /Zc:char8_t compiler option * PR review edit, date * Typo: B::f instead of B::F * Add u8 C++20 changes * Add io.h header into example code Repro: 1. Paste sample code for _get_errno is placed into new Visual Studio 2019 project 1. Try to compile Result: Compilation fails The error is: Error C3861 '_sopen_s': identifier not found Expected Result: Sample code should just compile Fix: Add io.h header file to avoid the above error in sample code. * Address 3340 Static member access in example * add Git screenshots and Git text * edit Git text and screenshot locale info * fix Version Control link error * move new Git content to the right moniker section * Remove unneeded share.h from sample code in errno documentation * Update docs/get-started/tutorial-console-cpp.md * Fixed typo in constructors-cpp.md * draft * added time_zone_link class * Update filesystem header explanation * fix links * Update filesystem.md Updated freshness date * add last_spec * 16.11 Refine applicability of /std:c++20 * a little more color around what a local_time is * simplify syntax block per style decision * add code example * acronlinx updates * arcolinx * Apply suggestions from code review Co-authored-by: Colin Robertson <corob@microsoft.com> Co-authored-by: TylerMSFT <Tyler.Whitney@microsoft.com> Co-authored-by: opbld15 <opbld15@microsoft.com> Co-authored-by: Tyler Whitney <TylerMSFT@users.noreply.github.com> Co-authored-by: opbld17 <opbld17@microsoft.com> Co-authored-by: ystamant <49958001+ystamant@users.noreply.github.com> Co-authored-by: opbld16 <opbld16@microsoft.com> Co-authored-by: Andrew Shymanel <88244804+ainrd@users.noreply.github.com> Co-authored-by: Garrett Campbell <86264750+gcampbell-msft@users.noreply.github.com> Co-authored-by: PRMerger6 <prmrgr6@microsoft.com> Co-authored-by: PRMerger12 <prmrgr12@microsoft.com> Co-authored-by: PRMerger14 <prmrgr14@microsoft.com> Co-authored-by: PRMerger16 <prmrgr16@microsoft.com> Co-authored-by: PRMerger15 <prmrgr15@microsoft.com> Co-authored-by: PRMerger7 <prmrgr7@microsoft.com> Co-authored-by: PRMerger10 <prmrgr10@microsoft.com> Co-authored-by: David Dyck <david.dyck@gmail.com> Co-authored-by: Kristine Toliver <ktoliver@users.noreply.github.com> Co-authored-by: Steve Wishnousky <stwish@microsoft.com> Co-authored-by: Sam Freed <sfreed141@gmail.com> Co-authored-by: Don Spencer <87099566+v-donspencer@users.noreply.github.com> Co-authored-by: Beau Braig <86677107+BeauBraig@users.noreply.github.com> Co-authored-by: Alex Guteniev <gutenev@gmail.com> Co-authored-by: Paula Miller <v-paulmi@microsoft.com> Co-authored-by: RibShark <1957489+RibShark@users.noreply.github.com> Co-authored-by: onihusube <44743040+onihusube@users.noreply.github.com> Co-authored-by: PRMerger8 <prmrgr8@microsoft.com> Co-authored-by: Chris Ho <sudoerchris.ho@pm.me> Co-authored-by: Andrew Rogers <andrew.rogers@wdc.com> Co-authored-by: Sauparna Palchowdhury <91951+sauparna@users.noreply.github.com> Co-authored-by: Nikolai Aristov <43590492+NikoAri@users.noreply.github.com> Co-authored-by: Terry G. Lee <terry.g.lee@microsoft.com> Co-authored-by: PRMerger20 <prmrgr20@microsoft.com> Co-authored-by: Andrea Courtright <74212614+v-andreaco@users.noreply.github.com> Co-authored-by: rayz-bee <303667851@qq.com> Co-authored-by: Stephan T. Lavavej <stl@microsoft.com>
1 parent 7156e4e commit 33288e0

7 files changed

Lines changed: 245 additions & 58 deletions

File tree

‎docs/standard-library/chrono-operators.md‎

Lines changed: 26 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
---
22
description: "Learn more about: &lt;chrono&gt; operators"
33
title: "&lt;chrono&gt; operators"
4-
ms.date: "08/13/2021"
5-
f1_keywords: ["chrono/std::operator modulo", "chrono/std::operator+", "chrono/std::chrono::day::operator+", "chrono/std::chrono::duration::operator+", "chrono/std::chrono::month::operator+", "chrono/std::chrono::time_point::operator+", "chrono/std::chrono::weekday::operator+", "chrono/std::chrono::year_month::operator+", "chrono/std::chrono::year::operator+", "chrono/std::chrono::year_month_day::operator+", "chrono/std::chrono::year_month_day_last::operator+", "chrono/std::chrono::year_month_weekday::operator+", "chrono/std::chrono::year_month_weekday_last::operator+", "chrono/std::operator!=", "chrono/std::operator*", "chrono/std::operator/", "chrono/std::operator-", "chrono/std::operator<", "chrono/std::operator<=", "chrono/std::operator<", "chrono/std::operator==", "chrono/std::operator>>", "chrono/std::operator<=>", "chrono/std::chrono::day::operator<=>", "chrono/std::chrono::month::operator<=>", "chrono/std::chrono::year::operator<=>", "chrono/std::chrono::year_month::operator<=>", "chrono/std::chrono::time_point::operator<=>", "chrono/std::chrono::duration::operator<=>", "chrono/std::chrono::month_day_last::operator<=>", "chrono/std::chrono::year_month_day_last::operator<=>", "chrono/std::operator==", "chrono/std::chrono::year::operator<==>", "chrono/std::chrono::day::operator==", "chrono/std::chrono::duration::operator==", "chrono/std::chrono::month::operator==", "chrono/std::chrono::month_day::operator==", "chrono/std::chrono::month_day_last::operator==", "chrono/std::chrono::month_weekday::operator==", "chrono/std::chrono::month_weekday_last::operator==", "chrono/std::chrono::time_point::operator==", "chrono/std::chrono::weekday::operator==", "chrono/std::chrono::year_month::operator==", "chrono/std::chrono::year::operator==", "chrono/std::chrono::year_month_day::operator==", "chrono/std::chrono::year_month_day_last::operator==", "chrono/std::chrono::year_month_weekday_last::operator==", "chrono/std::chrono::year_month_weekday::operator==", "chrono/std::chrono::month_weekday_last::operator==", "chrono/std::chrono::weekday::operator==", "chrono/std::chrono::weekday_last::operator==", "chrono/std::chrono::year_month_weekday_indexed::operator==", "chrono/std::chrono::year_month_weekday_last::operator==", "chrono/std::chrono::year::operator==", "chrono/std::chrono::year_month::operator==", "chrono/std::chrono::year_month_day::operator==", "chrono/std::chrono::year_month_day_last::operator==", "chrono/std::operator-", "chrono/std::chrono::day::operator-", "chrono/std::chrono::duration::operator-", "chrono/std::chrono::month::operator-", "chrono/std::chrono::time_point::operator-", "chrono/std::chrono::weekday::operator-", "chrono/std::chrono::year_month::operator-", "chrono/std::chrono::year::operator-", "chrono/std::chrono::year_month_day::operator-", "chrono/std::chrono::year_month_day_last::operator-", "chrono/std::chrono::year_month_weekday::operator-", "chrono/std::chrono::year_month_weekday_last::operator-", "chrono/std::chrono::day::operator<<", "chrono/std::chrono::hh_mm_ss::operator<<", "chrono/std::chrono::month_day::operator<<", "chrono/std::chrono::month_day_last::operator<<", "chrono/std::chrono::month_weekday::operator<<", "chrono/std::chrono::month_weekday_last::operator<<", "chrono/std::chrono::weekday::operator<<", "chrono/std::chrono::weekday_indexed::operator<<", "chrono/std::chrono::weekday_last::operator<<", "chrono/std::chrono::year::operator<<", "chrono/std::chrono::year_month_day::operator<<", "chrono/std::chrono::year_month_day_last::operator<<", "chrono/std::chrono::year_month_weekday::operator<<", "chrono/std::chrono::utc_time::operator<<", "chrono/std::chrono::tai_time::operator<<", "chrono/std::chrono::gps_time::operator<<", "chrono/std::chrono::local_time::operator<<", "chrono/std::chrono::file_time::operator<<"]
4+
ms.date: 09/02/2021
5+
f1_keywords: ["chrono/std::operator modulo", "chrono/std::operator+", "chrono/std::chrono::day::operator+", "chrono/std::chrono::duration::operator+", "chrono/std::chrono::month::operator+", "chrono/std::chrono::time_point::operator+", "chrono/std::chrono::weekday::operator+", "chrono/std::chrono::year_month::operator+", "chrono/std::chrono::year::operator+", "chrono/std::chrono::year_month_day::operator+", "chrono/std::chrono::year_month_day_last::operator+", "chrono/std::chrono::year_month_weekday::operator+", "chrono/std::chrono::year_month_weekday_last::operator+", "chrono/std::operator!=", "chrono/std::operator*", "chrono/std::operator/", "chrono/std::operator-", "chrono/std::operator<", "chrono/std::operator<=", "chrono/std::operator<", "chrono/std::operator==", "chrono/std::operator>>", "chrono/std::operator<=>", "chrono/std::chrono::day::operator<=>", "chrono/std::chrono::month::operator<=>", "chrono/std::chrono::year::operator<=>", "chrono/std::chrono::year_month::operator<=>", "chrono/std::chrono::time_point::operator<=>", "chrono/std::chrono::time_zone_link::operator<=>", "chrono/std::chrono::time_zone_link::operator==", "chrono/std::chrono::duration::operator<=>", "chrono/std::chrono::month_day_last::operator<=>", "chrono/std::chrono::year_month_day_last::operator<=>", "chrono/std::operator==", "chrono/std::chrono::year::operator<==>", "chrono/std::chrono::day::operator==", "chrono/std::chrono::duration::operator==", "chrono/std::chrono::month::operator==", "chrono/std::chrono::month_day::operator==", "chrono/std::chrono::month_day_last::operator==", "chrono/std::chrono::month_weekday::operator==", "chrono/std::chrono::month_weekday_last::operator==", "chrono/std::chrono::time_point::operator==", "chrono/std::chrono::weekday::operator==", "chrono/std::chrono::year_month::operator==", "chrono/std::chrono::year::operator==", "chrono/std::chrono::year_month_day::operator==", "chrono/std::chrono::year_month_day_last::operator==", "chrono/std::chrono::year_month_weekday_last::operator==", "chrono/std::chrono::year_month_weekday::operator==", "chrono/std::chrono::month_weekday_last::operator==", "chrono/std::chrono::weekday::operator==", "chrono/std::chrono::weekday_last::operator==", "chrono/std::chrono::year_month_weekday_indexed::operator==", "chrono/std::chrono::year_month_weekday_last::operator==", "chrono/std::chrono::year::operator==", "chrono/std::chrono::year_month::operator==", "chrono/std::chrono::year_month_day::operator==", "chrono/std::chrono::year_month_day_last::operator==", "chrono/std::operator-", "chrono/std::chrono::day::operator-", "chrono/std::chrono::duration::operator-", "chrono/std::chrono::month::operator-", "chrono/std::chrono::time_point::operator-", "chrono/std::chrono::weekday::operator-", "chrono/std::chrono::year_month::operator-", "chrono/std::chrono::year::operator-", "chrono/std::chrono::year_month_day::operator-", "chrono/std::chrono::year_month_day_last::operator-", "chrono/std::chrono::year_month_weekday::operator-", "chrono/std::chrono::year_month_weekday_last::operator-", "chrono/std::chrono::day::operator<<", "chrono/std::chrono::hh_mm_ss::operator<<", "chrono/std::chrono::month_day::operator<<", "chrono/std::chrono::month_day_last::operator<<", "chrono/std::chrono::month_weekday::operator<<", "chrono/std::chrono::month_weekday_last::operator<<", "chrono/std::chrono::weekday::operator<<", "chrono/std::chrono::weekday_indexed::operator<<", "chrono/std::chrono::weekday_last::operator<<", "chrono/std::chrono::year::operator<<", "chrono/std::chrono::year_month_day::operator<<", "chrono/std::chrono::year_month_day_last::operator<<", "chrono/std::chrono::year_month_weekday::operator<<", "chrono/std::chrono::utc_time::operator<<", "chrono/std::chrono::tai_time::operator<<", "chrono/std::chrono::gps_time::operator<<", "chrono/std::chrono::local_time::operator<<", "chrono/std::chrono::file_time::operator<<"]
66
---
77
# `<chrono>` operators
88

@@ -109,7 +109,7 @@ constexpr year_month_weekday_last operator+(const years& dy, const year_month_we
109109
110110
4\) Returns the result of `d+ds.count()`. If the result is out of the range [0, 255], then the result is unspecified.
111111
112-
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.
112+
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
114114
6\) Returns the result of adding the number of days/weekdays to the `weekday`. The result will be modulo 7, so always in the range \[0,6]
115115
@@ -119,7 +119,7 @@ constexpr year_month_weekday_last operator+(const years& dy, const year_month_we
119119
120120
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
122-
10\) Returns `(ymdl.year() / ymdl.month() + dm) / last`. Note: The `/` used here is not a division operator but the date operator.
122+
10\) Returns `(ymdl.year() / ymdl.month() + dm) / last`. Note: The `/` used here isn't a division operator but the date operator.
123123
124124
11\) Returns `ymdl + dm`.
125125
@@ -129,7 +129,7 @@ constexpr year_month_weekday_last operator+(const years& dy, const year_month_we
129129
130130
14-15\) Returns `{ymwd.year()+dy, ymwd.month(), ymwd.weekday_indexed()}`.
131131
132-
16\) Returns `(ymwdl.year() / ymwdl.month() + dm) / ymwdl.weekday_last()`. Note: The `/` used here is not a division operator but the date operator.
132+
16\) Returns `(ymwdl.year() / ymwdl.month() + dm) / ymwdl.weekday_last()`. Note: The `/` used here isn't a division operator but the date operator.
133133
134134
17\) Returns: `ymwdl + dy`
135135
@@ -307,9 +307,9 @@ constexpr year_month_weekday_last operator-(const year_month_weekday_last& ymwdl
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
310-
11\) Returns the result of subtracting a number of months or years from a `year_month` value.
310+
11\) Returns the result of subtracting months or years from a `year_month` value.
311311
312-
12\) Returns the result of subtracting a number of months years from a `year_month_day` value.
312+
12\) Returns the result of subtracting months years from a `year_month_day` value.
313313
314314
13\) Returns the result of subtracting the number of months from the `year_month_day_last` value. Essentially: `ymdl-dm`.
315315
@@ -567,7 +567,8 @@ Determines whether:
567567
14\) [`year_month_day`](year-month-day-class.md) represent the same year, month, and day.\
568568
15\) [`year_month_day_last`](year-month-day-last-class.md) represent the same last day of the year and month.\
569569
16\) [`year_month_weekday`](year-month-weekday-class.md) represent the same weekday, year, and month.\
570-
17\) [`year_month_weekday_last`](year-month-weekday-last-class.md) represent the same last weekday of the month, year, and month.
570+
17\) [`year_month_weekday_last`](year-month-weekday-last-class.md) represent the same last weekday of the month, year, and month.\
571+
18\) [`time_zone_link`](time-zone-link-class.md) have the same `name`. The `target` name isn't considered.
571572

572573
```cpp
573574
// 1) duration<Rep, Period>
@@ -626,6 +627,9 @@ constexpr bool operator==(const year_month_weekday& Left, const year_month_weekd
626627

627628
// 17) year_month_weekday_last
628629
constexpr bool operator==(const year_month_weekday_last& Left, const year_month_weekday_last& Right) noexcept; // C++ 20
630+
631+
// 18) time_zone_link
632+
bool operator==(const time_zone_link& Left, const time_zone_link& Right) noexcept;
629633
```
630634
631635
### Parameters
@@ -638,9 +642,10 @@ The right object to compare.
638642
639643
### Return value
640644
641-
1\) Returns **`true`** if *`Left`* and *`Right`* represent time intervals that have the same length. Otherwise, the function returns **`false`**.\
645+
1\) Returns **`true`** if *`Left`* and *`Right`* represent time intervals that have the same length. Otherwise, returns **`false`**.\
642646
2\) Returns **`true`** if *`Left`* and *`Right`* represent the same point in time. Otherwise, returns **`false`**.\
643-
3-17\) Returns **`true`** if *`Left`* and *`Right`* have the same value. Otherwise, returns **`false`**.
647+
3-17\) Returns **`true`** if *`Left`* and *`Right`* have the same value. Otherwise, returns **`false`**.\
648+
18\) Returns **`true`** if `Left.name() == Right.name()`. Otherwise, returns `*false*`.
644649
645650
## <a name="op_gt"></a> `operator>`
646651
@@ -708,6 +713,7 @@ The spaceship operator, in conjunction with `operator==`, synthesizes operators
708713
- [`month_day`](month-day-class.md)
709714
- [`month_day_last`](month-day-last-class.md)
710715
- [`time_point`](time-point-class.md)
716+
- [`time_zone_link`](time-zone-link-class.md)
711717
- [`year`](year-class.md)
712718
- [`year_month`](year-month-class.md)
713719
- [`year_month_day_last`](year-month-day-last-class.md)
@@ -736,12 +742,15 @@ constexpr strong_ordering operator<=>(const month_day_last& Left, const month_da
736742
737743
// 3)
738744
constexpr strong_ordering operator<=>(const year_month_day_last& Left, const year_month_day_last& Right) noexcept;
745+
746+
//4)
747+
strong_ordering operator<=>(const time_zone_link& Left, const time_zone_link& Right) noexcept;
739748
```
740749

741750
### Parameters
742751

743752
*`Left`, `Right`*\
744-
The [`day`](day-class.md), [`duration`](duration-class.md), [`month`](month-class.md), [`month_day`](month-day-class.md), [`month_day_last`](month-day-last-class.md), [`time_point`](time-point-class.md), [`year`](year-class.md), [`year_month`](year-month-class.md), [`year_month_day`](year-month-day-class.md), [`year_month_day_last`](year-month-day-last-class.md) to compare.
753+
The [`day`](day-class.md), [`duration`](duration-class.md), [`month`](month-class.md), [`month_day`](month-day-class.md), [`month_day_last`](month-day-last-class.md), [`time_point`](time-point-class.md), [`time_zone_link`](time-zone-link-class.md), [`year`](year-class.md), [`year_month`](year-month-class.md), [`year_month_day`](year-month-day-class.md), [`year_month_day_last`](year-month-day-last-class.md) to compare.
745754

746755
### Return value
747756

@@ -761,6 +770,12 @@ if (auto c = Left.year() <=> Right.year(); c != 0) return c;
761770
return Left.month_day_last() <=> Right.month_day_last();
762771
```
763772

773+
4\)\
774+
Equivalent to:
775+
```cpp
776+
Left.name() <=> Right.name()
777+
```
778+
764779
### Example: `operator<=>`
765780

766781
```cpp

0 commit comments

Comments
 (0)