From Jason Turner

[time.hms.overview]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpfqs07_s4/{from.md → to.md} +44 -0
tmp/tmpfqs07_s4/{from.md → to.md} RENAMED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ### Overview <a id="time.hms.overview">[[time.hms.overview]]</a>
2
+
3
+ ``` cpp
4
+ namespace std::chrono {
5
+ template<class Duration> class hh_mm_ss {
6
+ public:
7
+ static constexpr unsigned fractional_width = see below;
8
+ using precision = see below;
9
+
10
+ constexpr hh_mm_ss() noexcept : hh_mm_ss{Duration::zero()} {}
11
+ constexpr explicit hh_mm_ss(Duration d);
12
+
13
+ constexpr bool is_negative() const noexcept;
14
+ constexpr chrono::hours hours() const noexcept;
15
+ constexpr chrono::minutes minutes() const noexcept;
16
+ constexpr chrono::seconds seconds() const noexcept;
17
+ constexpr precision subseconds() const noexcept;
18
+
19
+ constexpr explicit operator precision() const noexcept;
20
+ constexpr precision to_duration() const noexcept;
21
+
22
+ private:
23
+ bool is_neg; // exposition only
24
+ chrono::hours h; // exposition only
25
+ chrono::minutes m; // exposition only
26
+ chrono::seconds s; // exposition only
27
+ precision ss; // exposition only
28
+ };
29
+ }
30
+ ```
31
+
32
+ The `hh_mm_ss` class template splits a `duration` into a multi-field
33
+ time structure *hours*:*minutes*:*seconds* and possibly *subseconds*,
34
+ where *subseconds* will be a duration unit based on a non-positive power
35
+ of 10. The `Duration` template parameter dictates the precision to which
36
+ the time is split. A `hh_mm_ss` models negative durations with a
37
+ distinct `is_negative` getter that returns `true` when the input
38
+ duration is negative. The individual duration fields always return
39
+ non-negative durations even when `is_negative()` indicates the structure
40
+ is representing a negative duration.
41
+
42
+ If `Duration` is not an instance of `duration`, the program is
43
+ ill-formed.
44
+