Skip to content

Commit c098f37

Browse files
authored
Merge pull request MicrosoftDocs#3538 from corob-msft/docs/corob/chrono-3
Add C++20 chrono free functions
2 parents ba4d716 + a527184 commit c098f37

File tree

5 files changed

+14
-18
lines changed

5 files changed

+14
-18
lines changed

docs/standard-library/chrono-functions.md

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -341,17 +341,13 @@ The input stream, *`is`*
341341
#include <chrono>
342342
#include <iostream>
343343
344-
using namespace std;
345-
using namespace std::chrono;
346-
347-
int Main()
344+
int main()
348345
{
349346
std::istringstream str{ "22" };
350-
std::basic_istream<char> stream{ str.rdbuf() };
351-
std::chrono::day d;
352-
std::chrono::from_stream(stream, "%d", d);
353-
std::cout << d << "\n";
354-
347+
std::basic_istream<char> stream{ str.rdbuf() };
348+
std::chrono::day d;
349+
std::chrono::from_stream(stream, "%d", d);
350+
std::cout << d << "\n";
355351
return 0;
356352
}
357353
```
@@ -398,8 +394,8 @@ The format may be one of these strings:
398394
| Specifier | Description |
399395
|--|--|
400396
| `%j` | If the type being formatted is a specialization of duration, the decimal number of days without padding. Otherwise, the day of the year as a decimal number. `Jan 1` is `001`. If the result is fewer than three digits, it's left-padded with `0` (zero) to three digits. |
401-
| `%U`<br>`%0U` | The week number of the year as a decimal number. The first Sunday of the year is the first day of week `01`. Days of the same year before that week are in week `00`. If the result is a single digit, it's prefixed with `0` (zero).<br>`%OU` (letter `O`, not zero) produces the locales alternative representation. |
402-
| `%W`<br>`%OW` |The week number of the year as a decimal number. The first Monday of the year is the first day of week `01`. Days of the same year before that week are in week `00`.<br>If the result is a single digit, it's prefixed with `0` (zero).<br>``%OW` (letter `O`, not zero) produces the locales alternative representation. |
397+
| `%U`<br>`%0U` | The week number of the year as a decimal number. The first Sunday of the year is the first day of week `01`. Days of the same year before that week are in week `00`. If the result is a single digit, it's prefixed with `0` (zero).<br>`%OU` (letter `O`, not zero) produces the locale's alternative representation. |
398+
| `%W`<br>`%OW` |The week number of the year as a decimal number. The first Monday of the year is the first day of week `01`. Days of the same year before that week are in week `00`.<br>If the result is a single digit, it's prefixed with `0` (zero).<br>`%OW` (letter `O`, not zero) produces the locale's alternative representation. |
403399

404400
### Time of day
405401

@@ -461,7 +457,7 @@ If *`abbrev`* isn't `nullptr`, and the format specifier `%Z` is specified, and t
461457
*`offset`*\
462458
If *`offset`* isn't `nullptr`, and the format specifier `%z` or modified variant such as `%Ez` or `%0z` is specified, and the parse is successful, then *`offset`* points to the parsed value.
463459

464-
### Which flags can be use which types
460+
### Flags by type
465461

466462
| Class | Specifier/Flag |
467463
|--|--|
@@ -846,4 +842,4 @@ Returns a `string` that contains the latest remote database version.
846842
[`chrono` operators](./chrono-operators.md)\
847843
[`duration` class](./duration-class.md)\
848844
[`time_point` class](./time-point-class.md)\
849-
[`time_zone` class](./time-zone-class.md)
845+
[`time_zone` class](./time-zone-class.md)

docs/standard-library/chrono.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
---
22
description: "Learn more about: &lt;chrono&gt;"
33
title: "&lt;chrono&gt;"
4-
ms.date: "05/07/2019"
4+
ms.date: 04/29/2021
55
f1_keywords: ["<chrono>", "chrono/std::chrono::nanoseconds", "chrono/std::chrono::minutes", "chrono/std::chrono::seconds", "chrono/std::chrono::hours", "chrono/std::chrono::milliseconds", "chrono/std::chrono::microseconds"]
6-
ms.assetid: 844de749-f306-482e-89bc-6f53c99c8324
76
---
87
# `<chrono>`
98

docs/standard-library/leap-second-class.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,4 +78,4 @@ Microsoft C++ supports `leap_second::value` starting in Visual Studio 2019 versi
7878
[`<chrono>`](./chrono.md)
7979
[`get_leap_second_info` function](./chrono-functions.md#std-chrono-get-leap-second-info)\
8080
[Header files reference](./cpp-standard-library-header-files.md)\
81-
[`leap_second_info` struct](./leap-second-info-struct.md)
81+
[`leap_second_info` struct](./leap-second-info-struct.md)

docs/standard-library/leap-second-info-struct.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,4 @@ namespace std::chrono {
4040
[`<chrono>`](./chrono.md)\
4141
[`get_leap_second_info`](./chrono-functions.md#std-chrono-get-leap-second-info)\
4242
[Header files reference](./cpp-standard-library-header-files.md)\
43-
[`leap_second` class](./leap-second-class.md)
43+
[`leap_second` class](./leap-second-class.md)

docs/standard-library/time-zone-class.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ The function template `to_sys` has two overloads that convert a `local_time` to
146146
template<class Duration>
147147
sys_time<common_type_t<Duration, seconds>>
148148
to_sys(const local_time<Duration>& lt) const; // Since C++20
149+
149150
template<class Duration>
150151
sys_time<common_type_t<Duration, seconds>>
151152
to_sys(const local_time<Duration>& lt, choose z) const; // Since C++20
@@ -177,4 +178,4 @@ Microsoft C++ supports `time_zone::to_sys` starting in Visual Studio 2019 versio
177178
## See also
178179

179180
[Header files reference](./cpp-standard-library-header-files.md)\
180-
[`<chrono>`](./chrono.md)
181+
[`<chrono>`](./chrono.md)

0 commit comments

Comments
 (0)