Skip to content

Commit 206ebfa

Browse files
author
Colin Robertson
committed
Add leap second info
1 parent a439341 commit 206ebfa

File tree

6 files changed

+174
-42
lines changed

6 files changed

+174
-42
lines changed

docs/standard-library/chrono-functions.md

Lines changed: 25 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -151,13 +151,15 @@ Casts a [time_point](../standard-library/time-point-class.md) object to a specif
151151
Parse the input stream into one of the `std::chrono` time or interval types such as `day`, `month`, or `year` using the specified format.
152152

153153
```cpp
154+
// 1) day
154155
template<class charT class traits, class Alloc = allocator<charT>>
155156
basic_istream<charT, traits>&
156157
from_stream(
157158
basic_istream<charT, traits>& is, const charT* fmt,
158159
day& d, basic_string<charT, traits, Alloc>* abbrev = nullptr,
159160
minutes* offset = nullptr);
160161

162+
// 2) duration
161163
template<class charT, class traits, class Rep, class Period, class Alloc = allocator<charT>>
162164
basic_istream<charT, traits>&
163165
from_stream(
@@ -344,7 +346,7 @@ int Main()
344346

345347
## <a name="parse-format-strings"></a> Parse format strings
346348

347-
The format may be one of the following:
349+
The format may be one of these strings:
348350

349351
### Date
350352

@@ -358,32 +360,32 @@ The format may be one of the following:
358360

359361
| Specifier | Description |
360362
|--|--|
361-
| `%d`<br>`%0d`<br>`%`*N*`d`<br>`%e`<br>`%0e`<br>`%`*N*`e` | The day of the month as a decimal number.<br> `%`*N*`d` specifies the maximum number of characters to read, for example `%1d`. If `N` is not specified, the default is 2.<br> Leading zeroes are permitted but not required. <br>`%Od` (letter `O`, not zero) interprets the locale’s alternative representation of the day of the month.<br>`%e` is equivalent to `%d` and can be modified like `%d` |
363+
| `%d`<br>`%0d`<br>`%`*N*`d`<br>`%e`<br>`%0e`<br>`%`*N*`e` | The day of the month as a decimal number.<br> `%`*N*`d` specifies the maximum number of characters to read, for example `%1d`. If `N` isn't specified, the default is 2.<br> Leading zeroes are permitted but not required. <br>`%Od` (letter `O`, not zero) interprets the locale’s alternative representation of the day of the month.<br>`%e` is equivalent to `%d` and can be modified like `%d` |
362364

363365
### Day of the week
364366

365367
| Specifier | Description |
366368
|--|--|
367369
| `%a`<br>`%A` | The locale’s full or abbreviated case-insensitive weekday name.<br>`%A` is equivalent to `%a` |
368-
| `%u`<br>`%`*`N`*`u` | The ISO weekday as a decimal number (1-7), where Monday is 1. `%`*`N`*`u` specifies the maximum number of characters to read, for example `%2u`. If `N` is not specified, the default is 1. Leading zeros are permitted but not required. |
369-
| `%w`<br>`%`*`N`*`w`<br>`%0w` | The weekday as a decimal number (0-6), where Sunday is 0.<br>`%`*`N`*`w` specifies the maximum number of characters to read, for example `%2w`. If `N` is not specified, the default is 1. Leading zeroes are permitted but not required.<br>`%Ow` (letter `O`, not zero) interprets the locale’s alternative representation. |
370+
| `%u`<br>`%`*`N`*`u` | The ISO weekday as a decimal number (1-7), where Monday is 1. `%`*`N`*`u` specifies the maximum number of characters to read, for example `%2u`. If `N` isn't specified, the default is 1. Leading zeros are permitted but not required. |
371+
| `%w`<br>`%`*`N`*`w`<br>`%0w` | The weekday as a decimal number (0-6), where Sunday is 0.<br>`%`*`N`*`w` specifies the maximum number of characters to read, for example `%2w`. If `N` isn't specified, the default is 1. Leading zeroes are permitted but not required.<br>`%Ow` (letter `O`, not zero) interprets the locale’s alternative representation. |
370372

371373
### Week/day of the year
372374

373375
| Specifier | Description |
374376
|--|--|
375-
| `%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 less than three digits, it is left-padded with 0 (zero) to three digits. |
376-
| `%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 prior to that are in week 00. If the result is a single digit, it is prefixed with 0 (zero).<br>`%OU` (letter `O`, not zero) produces the locale’s alternative representation. |
377-
| `%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 prior to that are in week 00.<br>If the result is a single digit, it is prefixed with 0 (zero).<br>``%OW` (letter `O`, not zero) produces the locale’s alternative representation. |
377+
| `%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. |
378+
| `%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. |
379+
| `%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. |
378380

379381
### Time of day
380382

381383
| Specifier | Description |
382384
|--|--|
383-
| `%H`<br>`%`*N*`H`<br>`%OH` | The hour (24-hour clock) as a decimal number. If the result is a single digit, it is prefixed with a 0 (zero).<br>`%`*N*`H` specifies the maximum number of characters to read, for example, `%1H`. If `N` is not specified, the default is 2.<br>Leading zeroes are permitted but not required.<br>`%OH` (letter `O`, not zero) produces the locale’s alternative representation. |
384-
| `%I`<br>`%`*N*`I`<br>`%OI` | The hour (12-hour clock) as a decimal number. If the result is a single digit, it is prefixed with 0 (zero).<br>`%`*N*`I` specifies the maximum number of characters to read, for example, `%1I`. If `N` is not specified, the default is 2.<br>Leading zeroes are permitted but not required.<br>`%OI` (letter `O`, not zero) produces the locale’s alternative representation. |
385-
| `%M`<br>`%`*N*`M`<br>`%OM` | The minutes as a decimal number. If the result is a single digit, it is prefixed with 0 (zero).<br>`%`*N*`M` specifies the maximum number of characters to read, for example `%3M`. If `N` is not specified, the default is 2.<br>Leading zeroes are permitted but not required.<br>`%OM` (letter `O`, not zero) produces the locale’s alternative representation.|
386-
|`%S`<br>`%`*N*`S`<br>`%OS` | Seconds as a decimal number. If the number of seconds is less than 10, the result is prefixed with 0 (zero). If the precision of the input cannot be exactly represented with seconds, then the format is a decimal floating-point number with a fixed format and a precision matching that of the precision of the input (or to a microseconds precision if the conversion to floating-point decimal seconds cannot be made within 18 fractional digits). The character for the decimal point is localized according to the locale.<br>`%`*N*`S` specifies the maximum number of characters to read, for example `%3S`. If `N` is not specified, the default is 2.<br>Leading zeroes are permitted but not required.<br>`%OS` (letter `O`, not zero) produces the locale’s alternative representation. |
385+
| `%H`<br>`%`*N*`H`<br>`%OH` | The hour (24-hour clock) as a decimal number. If the result is a single digit, it's prefixed with a `0` (zero).<br>`%`*N*`H` specifies the maximum number of characters to read, for example, `%1H`. If `N` isn't specified, the default is 2.<br>Leading zeroes are permitted but not required.<br>`%OH` (letter `O`, not zero) produces the locale’s alternative representation. |
386+
| `%I`<br>`%`*N*`I`<br>`%OI` | The hour (12-hour clock) as a decimal number. If the result is a single digit, it's prefixed with `0` (zero).<br>`%`*N*`I` specifies the maximum number of characters to read, for example, `%1I`. If `N` isn't specified, the default is 2.<br>Leading zeroes are permitted but not required.<br>`%OI` (letter `O`, not zero) produces the locale’s alternative representation. |
387+
| `%M`<br>`%`*N*`M`<br>`%OM` | The minutes as a decimal number. If the result is a single digit, it's prefixed with `0` (zero).<br>`%`*N*`M` specifies the maximum number of characters to read, for example `%3M`. If `N` isn't specified, the default is 2.<br>Leading zeroes are permitted but not required.<br>`%OM` (letter `O`, not zero) produces the locale’s alternative representation.|
388+
|`%S`<br>`%`*N*`S`<br>`%OS` | Seconds as a decimal number. If the number of seconds is less than 10, the result is prefixed with `0` (zero). If the precision of the input can't be exactly represented with seconds, then the format is a decimal floating-point number with a fixed format. It has a microseconds precision if the function can't convert the floating-point decimal seconds within 18 fractional digits. Otherwise, its precision matches the precision of the input. The character for the decimal point is localized according to the locale.<br>`%`*N*`S` specifies the maximum number of characters to read, for example `%3S`. If `N` isn't specified, the default is 2.<br>Leading zeroes are permitted but not required.<br>`%OS` (letter `O`, not zero) produces the locale’s alternative representation. |
387389
| `%p` | The locale’s equivalent of the AM/PM designations associated with a 12-hour clock. |
388390
| `%r` | The locale’s 12-hour clock time. |
389391
| `%R` | Equivalent to `%H:%M`. |
@@ -394,26 +396,26 @@ The format may be one of the following:
394396

395397
| Specifier | Description |
396398
|--|--|
397-
|`%b`, `%B`, `%h`| The locale’s abbreviated month name. If the value does not contain a valid month, a `format_error` exception is thrown.<br>`%h` is equivalent to `%b`. |
398-
| `%m`, `%`*n*`m`, `%Om` | The month as a decimal number. Jan is 1.<br>`%`*N*`m` specifies the maximum number of characters to read, for example, `%3m`. If `N` is not specified, the default is 2.<br>Leading zeroes are permitted but not required.<br>`%Om` (letter `O`, not zero) interprets the locale’s alternative representation.|
399+
|`%b`, `%B`, `%h`| The locale’s abbreviated month name. If the value doesn't contain a valid month, a `format_error` exception is thrown.<br>`%h` is equivalent to `%b`. |
400+
| `%m`, `%`*n*`m`, `%Om` | The month as a decimal number. Jan is 1.<br>`%`*N*`m` specifies the maximum number of characters to read, for example, `%3m`. If `N` isn't specified, the default is 2.<br>Leading zeroes are permitted but not required.<br>`%Om` (letter `O`, not zero) interprets the locale’s alternative representation.|
399401

400402
### Year
401403

402404
| Specifier | Description |
403405
|--|--|
404-
|`%C`, `%`*N*`C`, `%EC`| The century as a decimal number.<br>`%`*N*`C` specifies the maximum number of characters to read, for example, `%1N`. If `N` is not specified, the default is 2. Leading zeroes are permitted but not required.<br>`%EC` interprets the locale’s alternative representation of the century. |
405-
|%y, `%`*N*`y`, `%Ey`, `%Oy` | The last two decimal digits of the year. If the century is not otherwise specified (for example with `%C`), values in the range [69, 99] are presumed to refer to the years 1969 to 1999, and values in the range [00, 68] are presumed to refer to the years 2000 to 2068.<br>Leading zeroes are permitted but not required.<br>`%Ey` and `%Oy` (letter `O`, not zero) interpret the locale’s alternative representation.|
406-
| %Y, `%EY` | The year as a decimal number. If the result is less than four digits it is left-padded with 0 (zero) to four digits.<br>`%EY` produces the locale’s alternative full year representation. |
406+
|`%C`, `%`*N*`C`, `%EC`| The century as a decimal number.<br>`%`*N*`C` specifies the maximum number of characters to read, for example, `%1N`. If `N` isn't specified, the default is 2. Leading zeroes are permitted but not required.<br>`%EC` interprets the locale’s alternative representation of the century. |
407+
|`%y`, `%`*N*`y`, `%Ey`, `%Oy` | The last two decimal digits of the year. If the century isn't otherwise specified (for example, by using `%C`), values in the range `[69, 99]` are presumed to refer to the years 1969 to 1999, and values in the range `[00, 68]` are presumed to refer to the years 2000 to 2068.<br>Leading zeroes are permitted but not required.<br>`%Ey` and `%Oy` (letter `O`, not zero) interpret the locale’s alternative representation.|
408+
| `%Y`, `%EY` | The year as a decimal number. If the result is fewer than four digits, it's left-padded with `0` (zero) to four digits.<br>`%EY` produces the locale’s alternative full year representation. |
407409

408410
### ISO 8601 week-based year
409411

410412
In ISO 8601, weeks begin with Monday. The first week of the year must include January 4 and include the first Thursday of the year.
411413

412414
| Specifier | Replacement |
413415
|:---------:|:------------------------------------------|
414-
| `%g`| The last two decimal digits of the ISO week-based year. If the result is a single digit, is prefixed by 0 (zero). |
415-
| `%G`| The ISO week-based year as a decimal number. If the result is less than four digits, it is left-padded with 0 (zero) to four digits. |
416-
| `%V`<br>`%OV`| The ISO week-based week number as a decimal number. If the result is a single digit, it is prefixed with 0 (zero).<br>`%OV` (letter `O`, not zero) produces the locale’s alternative representation |
416+
| `%g`| The last two decimal digits of the ISO week-based year. If the result is a single digit, is prefixed by `0` (zero). |
417+
| `%G`| The ISO week-based year as a decimal number. If the result is fewer than four digits, it's left-padded with `0` (zero) to four digits. |
418+
| `%V`<br>`%OV`| The ISO week-based week number as a decimal number. If the result is a single digit, it's prefixed with `0` (zero).<br>`%OV` (letter `O`, not zero) produces the locale’s alternative representation |
417419

418420
### General
419421

@@ -422,9 +424,9 @@ In ISO 8601, weeks begin with Monday. The first week of the year must include Ja
422424
| `%%` | Matches the % character |
423425
| `%c`<br>%Ec% | The locale’s date and time representation.<br>`%Ec` interprets the locale’s alternate date and time representation. |
424426
| `%n` | Matches a new-line character |
425-
| `%t` | Matches zero or one whitespace characters |
427+
| `%t` | Matches zero or one whitespace character |
426428
| `%z`<br>`%Ez%`<br>`%Oz` | The offset from UTC in the format `[+|-]hh[mm]`. For example, `-0430` refers to 4 hours 30 minutes behind UTC, and `04` refers to 4 hours ahead of UTC.<br>`%Ez` and `%Oz` (letter `O`, not zero) parse a `:` between the hours and minutes and render leading zeroes on the hour field optional: `[+|-]h[h][:mm]`. For example, `-04:30` refers to 4 hours 30 minutes behind UTC, and 4 refers to 4 hours ahead of UTC. |
427-
| `%Z` | The time zone abbreviation or name. A single word is parsed. This word can only contain characters from the basic source character set that are alphanumeric, or one of `_`, `/`, `-’`, or `+`.
429+
| `%Z` | The time zone abbreviation or name. A single word is parsed. This word can only contain alphanumeric characters from the basic source character set, or one of `_`, `/`, `-’`, or `+`.
428430

429431
*`d`*\
430432
If the parse is successful, contains the parsed day when the function returns.
@@ -651,7 +653,8 @@ If `is_pm` is **`false`**, `make24` returns the 24-hour equivalent of *`h`* in t
651653

652654
## <a name="std-chrono-get-leap-second-info"></a> `get_leap_second_info`
653655

654-
Returns a `leap_second_info` for the specified time.
656+
Returns a [`leap_second_info`](./leap-second-info-struct.md)\
657+
for the specified time.
655658

656659
### Syntax
657660

docs/standard-library/chrono.md

Lines changed: 14 additions & 14 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

@@ -21,21 +20,22 @@ Beginning in Visual Studio 2015, the implementation of `steady_clock` has change
2120

2221
### Classes
2322

24-
|Name|Description|
25-
|-|-|
26-
|[`duration` Class](../standard-library/duration-class.md)|Describes a type that holds a time interval.|
27-
|[`time_point` Class](../standard-library/time-point-class.md)|Describes a type that represents a point in time.|
23+
| Name | Description |
24+
|--|--|
25+
| [`duration` class](../standard-library/duration-class.md) | Describes a type that holds a time interval. |
26+
| [`time_point` class](../standard-library/time-point-class.md) | Describes a type that represents a point in time. |
27+
| [`time_zone` class](../standard-library/time-point-class.md) | Represents all time zone transitions for a specific geographic area. |
2828

2929
### Structs
3030

31-
|Name|Description|
32-
|-|-|
33-
|[`common_type` Structure](../standard-library/common-type-structure.md)|Describes specializations of class template [`common_type`](../standard-library/common-type-class.md) for instantiations of `duration` and `time_point`.|
34-
|[`duration_values` Structure](../standard-library/duration-values-structure.md)|Provides specific values for the `duration` template parameter `Rep`.|
35-
|[`high_resolution_clock` struct](../standard-library/high-resolution-clock-struct.md)||
36-
|[`steady_clock` struct](../standard-library/steady-clock-struct.md)|Represents a `steady` clock.|
37-
|[`system_clock` Structure](../standard-library/system-clock-structure.md)|Represents a *`clock type`* that is based on the real-time clock of the system.|
38-
|[`treat_as_floating_point` Structure](../standard-library/treat-as-floating-point-structure.md)|Specifies whether a type can be treated as a floating-point type.|
31+
| Name | Description |
32+
|--|--|
33+
| [`common_type` struct](../standard-library/common-type-structure.md) | Describes specializations of class template [`common_type`](../standard-library/common-type-class.md) for instantiations of `duration` and `time_point`. |
34+
| [`duration_values` struct](../standard-library/duration-values-structure.md) | Provides specific values for the `duration` template parameter `Rep`. |
35+
| [`high_resolution_clock` struct](../standard-library/high-resolution-clock-struct.md) | |
36+
| [`steady_clock` struct](../standard-library/steady-clock-struct.md) | Represents a `steady` clock. |
37+
| [`system_clock` struct](../standard-library/system-clock-structure.md) | Represents a *`clock type`* that is based on the real-time clock of the system. |
38+
| [`treat_as_floating_point` struct](../standard-library/treat-as-floating-point-structure.md) | Specifies whether a type can be treated as a floating-point type. |
3939

4040
### Functions
4141

0 commit comments

Comments
 (0)