From Jason Turner

[time.duration.io]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpxrf2s3ij/{from.md → to.md} +78 -0
tmp/tmpxrf2s3ij/{from.md → to.md} RENAMED
@@ -0,0 +1,78 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ### I/O <a id="time.duration.io">[[time.duration.io]]</a>
2
+
3
+ ``` cpp
4
+ template<class charT, class traits, class Rep, class Period>
5
+ basic_ostream<charT, traits>&
6
+ operator<<(basic_ostream<charT, traits>& os, const duration<Rep, Period>& d);
7
+ ```
8
+
9
+ *Effects:* Inserts the duration `d` onto the stream `os` as if it were
10
+ implemented as follows:
11
+
12
+ ``` cpp
13
+ basic_ostringstream<charT, traits> s;
14
+ s.flags(os.flags());
15
+ s.imbue(os.getloc());
16
+ s.precision(os.precision());
17
+ s << d.count() << units-suffix;
18
+ return os << s.str();
19
+ ```
20
+
21
+ where *`units-suffix`* depends on the type `Period::type` as follows:
22
+
23
+ - If `Period::type` is `atto`, *`units-suffix`* is `"as"`.
24
+ - Otherwise, if `Period::type` is `femto`, *`units-suffix`* is `"fs"`.
25
+ - Otherwise, if `Period::type` is `pico`, *`units-suffix`* is `"ps"`.
26
+ - Otherwise, if `Period::type` is `nano`, *`units-suffix`* is `"ns"`.
27
+ - Otherwise, if `Period::type` is `micro`, it is
28
+ *implementation-defined* whether *`units-suffix`* is `"`\textmu`s"`
29
+ (`"\u00b5\u0073"`) or `"us"`.
30
+ - Otherwise, if `Period::type` is `milli`, *`units-suffix`* is `"ms"`.
31
+ - Otherwise, if `Period::type` is `centi`, *`units-suffix`* is `"cs"`.
32
+ - Otherwise, if `Period::type` is `deci`, *`units-suffix`* is `"ds"`.
33
+ - Otherwise, if `Period::type` is `ratio<1>`, *`units-suffix`* is `"s"`.
34
+ - Otherwise, if `Period::type` is `deca`, *`units-suffix`* is `"das"`.
35
+ - Otherwise, if `Period::type` is `hecto`, *`units-suffix`* is `"hs"`.
36
+ - Otherwise, if `Period::type` is `kilo`, *`units-suffix`* is `"ks"`.
37
+ - Otherwise, if `Period::type` is `mega`, *`units-suffix`* is `"Ms"`.
38
+ - Otherwise, if `Period::type` is `giga`, *`units-suffix`* is `"Gs"`.
39
+ - Otherwise, if `Period::type` is `tera`, *`units-suffix`* is `"Ts"`.
40
+ - Otherwise, if `Period::type` is `peta`, *`units-suffix`* is `"Ps"`.
41
+ - Otherwise, if `Period::type` is `exa`, *`units-suffix`* is `"Es"`.
42
+ - Otherwise, if `Period::type` is `ratio<60>`, *`units-suffix`* is
43
+ `"min"`.
44
+ - Otherwise, if `Period::type` is `ratio<3600>`, *`units-suffix`* is
45
+ `"h"`.
46
+ - Otherwise, if `Period::type` is `ratio<86400>`, *`units-suffix`* is
47
+ `"d"`.
48
+ - Otherwise, if `Period::type::den == 1`, *`units-suffix`* is
49
+ `"[`*`num`*`]s"`.
50
+ - Otherwise, *`units-suffix`* is `"[`*`num`*`/`*`den`*`]s"`.
51
+
52
+ In the list above, the use of *`num`* and *`den`* refer to the static
53
+ data members of `Period::type`, which are converted to arrays of `charT`
54
+ using a decimal conversion with no leading zeroes.
55
+
56
+ *Returns:* `os`.
57
+
58
+ ``` cpp
59
+ template<class charT, class traits, class Rep, class Period, class Alloc = allocator<charT>>
60
+ basic_istream<charT, traits>&
61
+ from_stream(basic_istream<charT, traits>& is, const charT* fmt,
62
+ duration<Rep, Period>& d,
63
+ basic_string<charT, traits, Alloc>* abbrev = nullptr,
64
+ minutes* offset = nullptr);
65
+ ```
66
+
67
+ *Effects:* Attempts to parse the input stream `is` into the duration `d`
68
+ using the format flags given in the NTCTS `fmt` as specified in
69
+ [[time.parse]]. If the parse parses everything specified by the parsing
70
+ format flags without error, and yet none of the flags impacts a
71
+ duration, `d` will be assigned a zero value. If `%Z` is used and
72
+ successfully parsed, that value will be assigned to `*abbrev` if
73
+ `abbrev` is non-null. If `%z` (or a modified variant) is used and
74
+ successfully parsed, that value will be assigned to `*offset` if
75
+ `offset` is non-null.
76
+
77
+ *Returns:* `is`.
78
+