tmp/tmp0icdbd5h/{from.md → to.md}
RENAMED
|
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#### Overview <a id="time.clock.system.overview">[[time.clock.system.overview]]</a>
|
| 2 |
+
|
| 3 |
+
``` cpp
|
| 4 |
+
namespace std::chrono {
|
| 5 |
+
class system_clock {
|
| 6 |
+
public:
|
| 7 |
+
using rep = see below;
|
| 8 |
+
using period = ratio<unspecified, unspecified{}>;
|
| 9 |
+
using duration = chrono::duration<rep, period>;
|
| 10 |
+
using time_point = chrono::time_point<system_clock>;
|
| 11 |
+
static constexpr bool is_steady = unspecified;
|
| 12 |
+
|
| 13 |
+
static time_point now() noexcept;
|
| 14 |
+
|
| 15 |
+
// mapping to/from C type time_t
|
| 16 |
+
static time_t to_time_t (const time_point& t) noexcept;
|
| 17 |
+
static time_point from_time_t(time_t t) noexcept;
|
| 18 |
+
};
|
| 19 |
+
}
|
| 20 |
+
```
|
| 21 |
+
|
| 22 |
+
Objects of type `system_clock` represent wall clock time from the
|
| 23 |
+
system-wide realtime clock. Objects of type `sys_time<Duration>` measure
|
| 24 |
+
time since 1970-01-01 00:00:00 UTC excluding leap seconds. This measure
|
| 25 |
+
is commonly referred to as *Unix time*. This measure facilitates an
|
| 26 |
+
efficient mapping between `sys_time` and calendar types [[time.cal]].
|
| 27 |
+
|
| 28 |
+
[*Example 1*:
|
| 29 |
+
`sys_seconds{sys_days{1970y/January/1}}.time_since_epoch()` is `0s`.
|
| 30 |
+
`sys_seconds{sys_days{2000y/January/1}}.time_since_epoch()` is
|
| 31 |
+
`946'684'800s`, which is `10'957 * 86'400s`.
|
| 32 |
+
— *end example*]
|
| 33 |
+
|