tmp/tmpdbfj7qm2/{from.md → to.md}
RENAMED
|
@@ -1,7 +1,9 @@
|
|
| 1 |
## Class template `duration` <a id="time.duration">[[time.duration]]</a>
|
| 2 |
|
|
|
|
|
|
|
| 3 |
A `duration` type measures time between two points in time
|
| 4 |
(`time_point`s). A `duration` has a representation which holds a count
|
| 5 |
of ticks and a tick period. The tick period is the amount of time which
|
| 6 |
occurs from one tick to the next, in units of seconds. It is expressed
|
| 7 |
as a rational constant using the template `ratio`.
|
|
@@ -65,12 +67,11 @@ ill-formed. If `Period::num` is not positive, the program is ill-formed.
|
|
| 65 |
Members of `duration` do not throw exceptions other than those thrown by
|
| 66 |
the indicated operations on their representations.
|
| 67 |
|
| 68 |
The defaulted copy constructor of duration shall be a constexpr function
|
| 69 |
if and only if the required initialization of the member `rep_` for copy
|
| 70 |
-
and move, respectively, would
|
| 71 |
-
function.
|
| 72 |
|
| 73 |
[*Example 1*:
|
| 74 |
|
| 75 |
``` cpp
|
| 76 |
duration<long, ratio<60>> d0; // holds a count of minutes using a long
|
|
@@ -100,11 +101,11 @@ duration<int, milli> d(3); // OK
|
|
| 100 |
duration<int, milli> d(3.5); // error
|
| 101 |
```
|
| 102 |
|
| 103 |
— *end example*]
|
| 104 |
|
| 105 |
-
*
|
| 106 |
|
| 107 |
``` cpp
|
| 108 |
template<class Rep2, class Period2>
|
| 109 |
constexpr duration(const duration<Rep2, Period2>& d);
|
| 110 |
```
|
|
@@ -597,11 +598,11 @@ where *`units-suffix`* depends on the type `Period::type` as follows:
|
|
| 597 |
`"d"`.
|
| 598 |
- Otherwise, if `Period::type::den == 1`, *`units-suffix`* is
|
| 599 |
`"[`*`num`*`]s"`.
|
| 600 |
- Otherwise, *`units-suffix`* is `"[`*`num`*`/`*`den`*`]s"`.
|
| 601 |
|
| 602 |
-
In the list above, the use of *`num`* and *`den`*
|
| 603 |
data members of `Period::type`, which are converted to arrays of `charT`
|
| 604 |
using a decimal conversion with no leading zeroes.
|
| 605 |
|
| 606 |
*Returns:* `os`.
|
| 607 |
|
|
@@ -614,15 +615,14 @@ template<class charT, class traits, class Rep, class Period, class Alloc = alloc
|
|
| 614 |
minutes* offset = nullptr);
|
| 615 |
```
|
| 616 |
|
| 617 |
*Effects:* Attempts to parse the input stream `is` into the duration `d`
|
| 618 |
using the format flags given in the NTCTS `fmt` as specified in
|
| 619 |
-
[[time.parse]]. If the parse
|
| 620 |
-
|
| 621 |
-
|
| 622 |
-
|
| 623 |
-
|
| 624 |
-
|
| 625 |
-
`offset` is non-null.
|
| 626 |
|
| 627 |
*Returns:* `is`.
|
| 628 |
|
|
|
|
| 1 |
## Class template `duration` <a id="time.duration">[[time.duration]]</a>
|
| 2 |
|
| 3 |
+
### General <a id="time.duration.general">[[time.duration.general]]</a>
|
| 4 |
+
|
| 5 |
A `duration` type measures time between two points in time
|
| 6 |
(`time_point`s). A `duration` has a representation which holds a count
|
| 7 |
of ticks and a tick period. The tick period is the amount of time which
|
| 8 |
occurs from one tick to the next, in units of seconds. It is expressed
|
| 9 |
as a rational constant using the template `ratio`.
|
|
|
|
| 67 |
Members of `duration` do not throw exceptions other than those thrown by
|
| 68 |
the indicated operations on their representations.
|
| 69 |
|
| 70 |
The defaulted copy constructor of duration shall be a constexpr function
|
| 71 |
if and only if the required initialization of the member `rep_` for copy
|
| 72 |
+
and move, respectively, would be constexpr-suitable [[dcl.constexpr]].
|
|
|
|
| 73 |
|
| 74 |
[*Example 1*:
|
| 75 |
|
| 76 |
``` cpp
|
| 77 |
duration<long, ratio<60>> d0; // holds a count of minutes using a long
|
|
|
|
| 101 |
duration<int, milli> d(3.5); // error
|
| 102 |
```
|
| 103 |
|
| 104 |
— *end example*]
|
| 105 |
|
| 106 |
+
*Effects:* Initializes `rep_` with `r`.
|
| 107 |
|
| 108 |
``` cpp
|
| 109 |
template<class Rep2, class Period2>
|
| 110 |
constexpr duration(const duration<Rep2, Period2>& d);
|
| 111 |
```
|
|
|
|
| 598 |
`"d"`.
|
| 599 |
- Otherwise, if `Period::type::den == 1`, *`units-suffix`* is
|
| 600 |
`"[`*`num`*`]s"`.
|
| 601 |
- Otherwise, *`units-suffix`* is `"[`*`num`*`/`*`den`*`]s"`.
|
| 602 |
|
| 603 |
+
In the list above, the use of *`num`* and *`den`* refers to the static
|
| 604 |
data members of `Period::type`, which are converted to arrays of `charT`
|
| 605 |
using a decimal conversion with no leading zeroes.
|
| 606 |
|
| 607 |
*Returns:* `os`.
|
| 608 |
|
|
|
|
| 615 |
minutes* offset = nullptr);
|
| 616 |
```
|
| 617 |
|
| 618 |
*Effects:* Attempts to parse the input stream `is` into the duration `d`
|
| 619 |
using the format flags given in the NTCTS `fmt` as specified in
|
| 620 |
+
[[time.parse]]. If the parse fails to decode a valid duration,
|
| 621 |
+
`is.setstate(ios_base::failbit)` is called and `d` is not modified. If
|
| 622 |
+
`%Z` is used and successfully parsed, that value will be assigned to
|
| 623 |
+
`*abbrev` if `abbrev` is non-null. If `%z` (or a modified variant) is
|
| 624 |
+
used and successfully parsed, that value will be assigned to `*offset`
|
| 625 |
+
if `offset` is non-null.
|
|
|
|
| 626 |
|
| 627 |
*Returns:* `is`.
|
| 628 |
|