tmp/tmpmv12x71z/{from.md → to.md}
RENAMED
|
@@ -1,8 +1,10 @@
|
|
| 1 |
## Clocks <a id="time.clock">[[time.clock]]</a>
|
| 2 |
|
| 3 |
-
|
|
|
|
|
|
|
| 4 |
requirements [[time.clock.req]] unless otherwise specified.
|
| 5 |
|
| 6 |
### Class `system_clock` <a id="time.clock.system">[[time.clock.system]]</a>
|
| 7 |
|
| 8 |
#### Overview <a id="time.clock.system.overview">[[time.clock.system.overview]]</a>
|
|
@@ -80,13 +82,11 @@ template<class charT, class traits, class Duration>
|
|
| 80 |
`false`, and `Duration{1} < days{1}` is `true`.
|
| 81 |
|
| 82 |
*Effects:* Equivalent to:
|
| 83 |
|
| 84 |
``` cpp
|
| 85 |
-
|
| 86 |
-
return os << format(os.getloc(), STATICALLY-WIDEN<charT>("{} {}"),
|
| 87 |
-
year_month_day{dp}, hh_mm_ss{tp-dp});
|
| 88 |
```
|
| 89 |
|
| 90 |
[*Example 1*:
|
| 91 |
|
| 92 |
``` cpp
|
|
@@ -165,11 +165,12 @@ measure time since this epoch instead, one can add/subtract the constant
|
|
| 165 |
|
| 166 |
[*Example 1*:
|
| 167 |
`clock_cast<utc_clock>(sys_seconds{sys_days{1970y/January/1}}).time_since_epoch()`
|
| 168 |
is `0s`.
|
| 169 |
`clock_cast<utc_clock>(sys_seconds{sys_days{2000y/January/1}}).time_since_epoch()`
|
| 170 |
-
is `946'684'822s`,
|
|
|
|
| 171 |
— *end example*]
|
| 172 |
|
| 173 |
`utc_clock` is not a *Cpp17TrivialClock* unless the implementation can
|
| 174 |
guarantee that `utc_clock::now()` does not propagate an exception.
|
| 175 |
|
|
@@ -237,11 +238,11 @@ template<class charT, class traits, class Duration>
|
|
| 237 |
```
|
| 238 |
|
| 239 |
*Effects:* Equivalent to:
|
| 240 |
|
| 241 |
``` cpp
|
| 242 |
-
return os << format(STATICALLY-WIDEN<charT>("{:%F %T}"), t);
|
| 243 |
```
|
| 244 |
|
| 245 |
[*Example 1*:
|
| 246 |
|
| 247 |
``` cpp
|
|
@@ -408,11 +409,11 @@ template<class charT, class traits, class Duration>
|
|
| 408 |
```
|
| 409 |
|
| 410 |
*Effects:* Equivalent to:
|
| 411 |
|
| 412 |
``` cpp
|
| 413 |
-
return os << format(STATICALLY-WIDEN<charT>("{:%F %T}"), t);
|
| 414 |
```
|
| 415 |
|
| 416 |
[*Example 1*:
|
| 417 |
|
| 418 |
``` cpp
|
|
@@ -506,11 +507,11 @@ template<class Duration>
|
|
| 506 |
```
|
| 507 |
|
| 508 |
*Returns:*
|
| 509 |
|
| 510 |
``` cpp
|
| 511 |
-
|
| 512 |
```
|
| 513 |
|
| 514 |
[*Note 1*:
|
| 515 |
|
| 516 |
``` cpp
|
|
@@ -548,11 +549,11 @@ template<class charT, class traits, class Duration>
|
|
| 548 |
```
|
| 549 |
|
| 550 |
*Effects:* Equivalent to:
|
| 551 |
|
| 552 |
``` cpp
|
| 553 |
-
return os << format(STATICALLY-WIDEN<charT>("{:%F %T}"), t);
|
| 554 |
```
|
| 555 |
|
| 556 |
[*Example 1*:
|
| 557 |
|
| 558 |
``` cpp
|
|
@@ -604,11 +605,11 @@ namespace std::chrono {
|
|
| 604 |
requirements [[time.clock.req]], and using a signed arithmetic type for
|
| 605 |
`file_clock::rep`. `file_clock` is used to create the `time_point`
|
| 606 |
system used for `file_time_type` [[filesystems]]. Its epoch is
|
| 607 |
unspecified, and `noexcept(file_clock::now())` is `true`.
|
| 608 |
|
| 609 |
-
[*Note 1*: The type that `file_clock` denotes
|
| 610 |
namespace than `std::chrono`, such as `std::filesystem`. — *end note*]
|
| 611 |
|
| 612 |
#### Member functions <a id="time.clock.file.members">[[time.clock.file.members]]</a>
|
| 613 |
|
| 614 |
The type denoted by `file_clock` provides precisely one of the following
|
|
@@ -648,11 +649,11 @@ template<class charT, class traits, class Duration>
|
|
| 648 |
```
|
| 649 |
|
| 650 |
*Effects:* Equivalent to:
|
| 651 |
|
| 652 |
``` cpp
|
| 653 |
-
return os << format(STATICALLY-WIDEN<charT>("{:%F %T}"), t);
|
| 654 |
```
|
| 655 |
|
| 656 |
``` cpp
|
| 657 |
template<class charT, class traits, class Duration, class Alloc = allocator<charT>>
|
| 658 |
basic_istream<charT, traits>&
|
|
@@ -896,12 +897,12 @@ template<class Duration>
|
|
| 896 |
-> decltype(SourceClock::to_sys(t));
|
| 897 |
```
|
| 898 |
|
| 899 |
*Constraints:* `SourceClock::to_sys(t)` is well-formed.
|
| 900 |
|
| 901 |
-
*Mandates:* `SourceClock::to_sys(t)` returns a `sys_time<
|
| 902 |
-
|
| 903 |
|
| 904 |
*Returns:* `SourceClock::to_sys(t)`.
|
| 905 |
|
| 906 |
``` cpp
|
| 907 |
template<class DestClock>
|
|
@@ -919,12 +920,12 @@ template<class Duration>
|
|
| 919 |
```
|
| 920 |
|
| 921 |
*Constraints:* `DestClock::from_sys(t)` is well-formed.
|
| 922 |
|
| 923 |
*Mandates:* `DestClock::from_sys(t)` returns a
|
| 924 |
-
`time_point<DestClock,
|
| 925 |
-
|
| 926 |
|
| 927 |
*Returns:* `DestClock::from_sys(t)`.
|
| 928 |
|
| 929 |
#### Conversions between `utc_clock` and other clocks <a id="time.clock.cast.utc">[[time.clock.cast.utc]]</a>
|
| 930 |
|
|
@@ -943,12 +944,12 @@ template<class Duration>
|
|
| 943 |
-> decltype(SourceClock::to_utc(t));
|
| 944 |
```
|
| 945 |
|
| 946 |
*Constraints:* `SourceClock::to_utc(t)` is well-formed.
|
| 947 |
|
| 948 |
-
*Mandates:* `SourceClock::to_utc(t)` returns a `utc_time<
|
| 949 |
-
|
| 950 |
|
| 951 |
*Returns:* `SourceClock::to_utc(t)`.
|
| 952 |
|
| 953 |
``` cpp
|
| 954 |
template<class DestClock>
|
|
@@ -966,12 +967,12 @@ template<class Duration>
|
|
| 966 |
```
|
| 967 |
|
| 968 |
*Constraints:* `DestClock::from_utc(t)` is well-formed.
|
| 969 |
|
| 970 |
*Mandates:* `DestClock::from_utc(t)` returns a
|
| 971 |
-
`time_point<DestClock,
|
| 972 |
-
|
| 973 |
|
| 974 |
*Returns:* `DestClock::from_utc(t)`.
|
| 975 |
|
| 976 |
#### Function template `clock_cast` <a id="time.clock.cast.fn">[[time.clock.cast.fn]]</a>
|
| 977 |
|
|
|
|
| 1 |
## Clocks <a id="time.clock">[[time.clock]]</a>
|
| 2 |
|
| 3 |
+
### General <a id="time.clock.general">[[time.clock.general]]</a>
|
| 4 |
+
|
| 5 |
+
The types defined in [[time.clock]] meet the *Cpp17TrivialClock*
|
| 6 |
requirements [[time.clock.req]] unless otherwise specified.
|
| 7 |
|
| 8 |
### Class `system_clock` <a id="time.clock.system">[[time.clock.system]]</a>
|
| 9 |
|
| 10 |
#### Overview <a id="time.clock.system.overview">[[time.clock.system.overview]]</a>
|
|
|
|
| 82 |
`false`, and `Duration{1} < days{1}` is `true`.
|
| 83 |
|
| 84 |
*Effects:* Equivalent to:
|
| 85 |
|
| 86 |
``` cpp
|
| 87 |
+
return os << format(os.getloc(), STATICALLY-WIDEN<charT>("{:L%F %T}"), tp);
|
|
|
|
|
|
|
| 88 |
```
|
| 89 |
|
| 90 |
[*Example 1*:
|
| 91 |
|
| 92 |
``` cpp
|
|
|
|
| 165 |
|
| 166 |
[*Example 1*:
|
| 167 |
`clock_cast<utc_clock>(sys_seconds{sys_days{1970y/January/1}}).time_since_epoch()`
|
| 168 |
is `0s`.
|
| 169 |
`clock_cast<utc_clock>(sys_seconds{sys_days{2000y/January/1}}).time_since_epoch()`
|
| 170 |
+
is `946'684'822s`,
|
| 171 |
+
which is `10'957 * 86'400s + 22s`.
|
| 172 |
— *end example*]
|
| 173 |
|
| 174 |
`utc_clock` is not a *Cpp17TrivialClock* unless the implementation can
|
| 175 |
guarantee that `utc_clock::now()` does not propagate an exception.
|
| 176 |
|
|
|
|
| 238 |
```
|
| 239 |
|
| 240 |
*Effects:* Equivalent to:
|
| 241 |
|
| 242 |
``` cpp
|
| 243 |
+
return os << format(os.getloc(), STATICALLY-WIDEN<charT>("{:L%F %T}"), t);
|
| 244 |
```
|
| 245 |
|
| 246 |
[*Example 1*:
|
| 247 |
|
| 248 |
``` cpp
|
|
|
|
| 409 |
```
|
| 410 |
|
| 411 |
*Effects:* Equivalent to:
|
| 412 |
|
| 413 |
``` cpp
|
| 414 |
+
return os << format(os.getloc(), STATICALLY-WIDEN<charT>("{:L%F %T}"), t);
|
| 415 |
```
|
| 416 |
|
| 417 |
[*Example 1*:
|
| 418 |
|
| 419 |
``` cpp
|
|
|
|
| 507 |
```
|
| 508 |
|
| 509 |
*Returns:*
|
| 510 |
|
| 511 |
``` cpp
|
| 512 |
+
utc_time<common_type_t<Duration, seconds>>{t.time_since_epoch()} + 315964809s
|
| 513 |
```
|
| 514 |
|
| 515 |
[*Note 1*:
|
| 516 |
|
| 517 |
``` cpp
|
|
|
|
| 549 |
```
|
| 550 |
|
| 551 |
*Effects:* Equivalent to:
|
| 552 |
|
| 553 |
``` cpp
|
| 554 |
+
return os << format(os.getloc(), STATICALLY-WIDEN<charT>("{:L%F %T}"), t);
|
| 555 |
```
|
| 556 |
|
| 557 |
[*Example 1*:
|
| 558 |
|
| 559 |
``` cpp
|
|
|
|
| 605 |
requirements [[time.clock.req]], and using a signed arithmetic type for
|
| 606 |
`file_clock::rep`. `file_clock` is used to create the `time_point`
|
| 607 |
system used for `file_time_type` [[filesystems]]. Its epoch is
|
| 608 |
unspecified, and `noexcept(file_clock::now())` is `true`.
|
| 609 |
|
| 610 |
+
[*Note 1*: The type that `file_clock` denotes can be in a different
|
| 611 |
namespace than `std::chrono`, such as `std::filesystem`. — *end note*]
|
| 612 |
|
| 613 |
#### Member functions <a id="time.clock.file.members">[[time.clock.file.members]]</a>
|
| 614 |
|
| 615 |
The type denoted by `file_clock` provides precisely one of the following
|
|
|
|
| 649 |
```
|
| 650 |
|
| 651 |
*Effects:* Equivalent to:
|
| 652 |
|
| 653 |
``` cpp
|
| 654 |
+
return os << format(os.getloc(), STATICALLY-WIDEN<charT>("{:L%F %T}"), t);
|
| 655 |
```
|
| 656 |
|
| 657 |
``` cpp
|
| 658 |
template<class charT, class traits, class Duration, class Alloc = allocator<charT>>
|
| 659 |
basic_istream<charT, traits>&
|
|
|
|
| 897 |
-> decltype(SourceClock::to_sys(t));
|
| 898 |
```
|
| 899 |
|
| 900 |
*Constraints:* `SourceClock::to_sys(t)` is well-formed.
|
| 901 |
|
| 902 |
+
*Mandates:* `SourceClock::to_sys(t)` returns a `sys_time<Duration2>` for
|
| 903 |
+
some type `Duration2` [[time.point.general]].
|
| 904 |
|
| 905 |
*Returns:* `SourceClock::to_sys(t)`.
|
| 906 |
|
| 907 |
``` cpp
|
| 908 |
template<class DestClock>
|
|
|
|
| 920 |
```
|
| 921 |
|
| 922 |
*Constraints:* `DestClock::from_sys(t)` is well-formed.
|
| 923 |
|
| 924 |
*Mandates:* `DestClock::from_sys(t)` returns a
|
| 925 |
+
`time_point<DestClock, Duration2>` for some type `Duration2`
|
| 926 |
+
[[time.point.general]].
|
| 927 |
|
| 928 |
*Returns:* `DestClock::from_sys(t)`.
|
| 929 |
|
| 930 |
#### Conversions between `utc_clock` and other clocks <a id="time.clock.cast.utc">[[time.clock.cast.utc]]</a>
|
| 931 |
|
|
|
|
| 944 |
-> decltype(SourceClock::to_utc(t));
|
| 945 |
```
|
| 946 |
|
| 947 |
*Constraints:* `SourceClock::to_utc(t)` is well-formed.
|
| 948 |
|
| 949 |
+
*Mandates:* `SourceClock::to_utc(t)` returns a `utc_time<Duration2>` for
|
| 950 |
+
some type `Duration2` [[time.point.general]].
|
| 951 |
|
| 952 |
*Returns:* `SourceClock::to_utc(t)`.
|
| 953 |
|
| 954 |
``` cpp
|
| 955 |
template<class DestClock>
|
|
|
|
| 967 |
```
|
| 968 |
|
| 969 |
*Constraints:* `DestClock::from_utc(t)` is well-formed.
|
| 970 |
|
| 971 |
*Mandates:* `DestClock::from_utc(t)` returns a
|
| 972 |
+
`time_point<DestClock, Duration2>` for some type `Duration2`
|
| 973 |
+
[[time.point.general]].
|
| 974 |
|
| 975 |
*Returns:* `DestClock::from_utc(t)`.
|
| 976 |
|
| 977 |
#### Function template `clock_cast` <a id="time.clock.cast.fn">[[time.clock.cast.fn]]</a>
|
| 978 |
|