From Jason Turner

[time.hms.members]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmp735r5hge/{from.md → to.md} +119 -0
tmp/tmp735r5hge/{from.md → to.md} RENAMED
@@ -0,0 +1,119 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ### Members <a id="time.hms.members">[[time.hms.members]]</a>
2
+
3
+ ``` cpp
4
+ static constexpr unsigned fractional_width = see below;
5
+ ```
6
+
7
+ `fractional_width` is the number of fractional decimal digits
8
+ represented by `precision`. `fractional_width` has the value of the
9
+ smallest possible integer in the range \[`0`, `18`\] such that
10
+ `precision` will exactly represent all values of `Duration`. If no such
11
+ value of `fractional_width` exists, then `fractional_width` is 6.
12
+
13
+ [*Example 1*:
14
+
15
+ See  [[time.hms.width]] for some durations, the resulting
16
+ `fractional_width`, and the formatted fractional second output of
17
+ `Duration{1}`.
18
+
19
+ **Table: Examples for `fractional_width`** <a id="time.hms.width">[time.hms.width]</a>
20
+
21
+ | | | |
22
+ | --------------------------------- | --- | ------------- |
23
+ | `hours`, `minutes`, and `seconds` | `0` | |
24
+ | `milliseconds` | `3` | `0.001` |
25
+ | `microseconds` | `6` | `0.000001` |
26
+ | `nanoseconds` | `9` | `0.000000001` |
27
+ | `duration<int, ratio<1, 2>>` | `1` | `0.5` |
28
+ | `duration<int, ratio<1, 3>>` | `6` | `0.333333` |
29
+ | `duration<int, ratio<1, 4>>` | `2` | `0.25` |
30
+ | `duration<int, ratio<1, 5>>` | `1` | `0.2` |
31
+ | `duration<int, ratio<1, 6>>` | `6` | `0.166666` |
32
+ | `duration<int, ratio<1, 7>>` | `6` | `0.142857` |
33
+ | `duration<int, ratio<1, 8>>` | `3` | `0.125` |
34
+ | `duration<int, ratio<1, 9>>` | `6` | `0.111111` |
35
+ | `duration<int, ratio<1, 10>>` | `1` | `0.1` |
36
+ | `duration<int, ratio<756, 625>>` | `4` | `0.2096` |
37
+
38
+
39
+ — *end example*]
40
+
41
+ ``` cpp
42
+ using precision = see below;
43
+ ```
44
+
45
+ `precision` is
46
+
47
+ ``` cpp
48
+ duration<common_type_t<Duration::rep, seconds::rep>, ratio<1, $10^fractional_width$>>
49
+ ```
50
+
51
+ ``` cpp
52
+ constexpr explicit hh_mm_ss(Duration d);
53
+ ```
54
+
55
+ *Effects:* Constructs an object of type `hh_mm_ss` which represents the
56
+ `Duration d` with precision `precision`.
57
+
58
+ - Initializes `is_neg` with `d < Duration::zero()`.
59
+ - Initializes `h` with `duration_cast<chrono::hours>(abs(d))`.
60
+ - Initializes `m` with
61
+ `duration_cast<chrono::minutes>(abs(d) - hours())`.
62
+ - Initializes `s` with
63
+ `duration_cast<chrono::seconds>(abs(d) - hours() - minutes())`.
64
+ - If `treat_as_floating_point_v<precision::rep>` is `true`, initializes
65
+ `ss` with `abs(d) - hours() - minutes() - seconds()`. Otherwise,
66
+ initializes `ss` with
67
+ `duration_cast<precision>(abs(d) - hours() - minutes() - seconds())`.
68
+
69
+ [*Note 1*: When `precision::rep` is integral and `precision::period` is
70
+ `ratio<1>`, `subseconds()` always returns a value equal to
71
+ `0s`. — *end note*]
72
+
73
+ *Ensures:* If `treat_as_floating_point_v<precision::rep>` is `true`,
74
+ `to_duration()` returns `d`, otherwise `to_duration()` returns
75
+ `duration_cast<precision>(d)`.
76
+
77
+ ``` cpp
78
+ constexpr bool is_negative() const noexcept;
79
+ ```
80
+
81
+ *Returns:* `is_neg`.
82
+
83
+ ``` cpp
84
+ constexpr chrono::hours hours() const noexcept;
85
+ ```
86
+
87
+ *Returns:* `h`.
88
+
89
+ ``` cpp
90
+ constexpr chrono::minutes minutes() const noexcept;
91
+ ```
92
+
93
+ *Returns:* `m`.
94
+
95
+ ``` cpp
96
+ constexpr chrono::seconds seconds() const noexcept;
97
+ ```
98
+
99
+ *Returns:* `s`.
100
+
101
+ ``` cpp
102
+ constexpr precision subseconds() const noexcept;
103
+ ```
104
+
105
+ *Returns:* `ss`.
106
+
107
+ ``` cpp
108
+ constexpr precision to_duration() const noexcept;
109
+ ```
110
+
111
+ *Returns:* If `is_neg`, returns `-(h + m + s + ss)`, otherwise returns
112
+ `h + m + s + ss`.
113
+
114
+ ``` cpp
115
+ constexpr explicit operator precision() const noexcept;
116
+ ```
117
+
118
+ *Returns:* `to_duration()`.
119
+