|
6 | 6 | <section><sref ref="[time.format]"/></section>
|
7 | 7 | <submitter>Jonathan Wakely</submitter>
|
8 | 8 | <date>08 Jul 2024</date>
|
9 |
| -<priority>99</priority> |
| 9 | +<priority>3</priority> |
10 | 10 |
|
11 | 11 | <discussion>
|
12 | 12 | <p>
|
@@ -58,32 +58,48 @@ which we know how to format?
|
58 | 58 | This is somewhat related to issue <iref ref="953"/>, since it's unclear
|
59 | 59 | which operations "a class emulating an arithmetic type" needs to support.
|
60 | 60 | </p>
|
| 61 | + |
| 62 | + |
| 63 | +<note>2024-07-31; Reflector poll</note> |
| 64 | +<p> |
| 65 | +Set priority to 3 after reflector poll. |
| 66 | +</p> |
| 67 | +<p> |
| 68 | +"Don't convert to an integer type, that would be wrong for |
| 69 | +<code>duration<long double></code> and could overflow for |
| 70 | +<code>duration<BigInt></code>." |
| 71 | +</p> |
| 72 | +<p>"`%Q` could format using `+d.count()`"</p> |
| 73 | +<p> |
| 74 | +Some requests to disallow using code unit types as duration reps, |
| 75 | +e.g. <code>duration<char></code>. Alternatively it just shouldn't |
| 76 | +be formattable. Alternatively, don't bother preventing dumb things. |
| 77 | +</p> |
| 78 | +<p> |
| 79 | +There's a similar issue in <code>operator<<</code> for |
| 80 | +`duration`, which writes `d.count()` to the stream. For a custom rep type |
| 81 | +that might be ill-formed. For character types it might print as a character |
| 82 | +not an integer. |
| 83 | +</p> |
| 84 | + |
61 | 85 | </discussion>
|
62 | 86 |
|
63 | 87 | <resolution>
|
64 | 88 | <p>
|
65 |
| -This wording is relative to <paper num="N4981"/>. |
| 89 | +This wording is relative to <paper num="N4986"/>. |
66 | 90 | </p>
|
67 | 91 | <ol>
|
68 |
| -<li><p>Modify <sref ref="[tab:time.format.spec]"/> as indicated:</p> |
| 92 | +<li><p>Modify <sref ref="[time.syn]"/> as indicated:</p> |
69 | 93 |
|
70 | 94 | <blockquote>
|
71 |
| -<table style="border: 1px solid; border-spacing: 1.5em"> |
72 |
| -<thead style="text-align: center"> |
73 |
| -<tr><th>Specifier</th><th>Replacement</th></tr> |
74 |
| -</thead> |
75 |
| -<tbody style="vertical-align: top"> |
76 |
| -<tr><td>…</td><td>…</td><td>…</td></tr> |
77 |
| -<tr> |
78 |
| -<td> `%Q` </td> |
79 |
| -<td> |
80 |
| -The duration’s numeric value (as if extracted via `.count()` |
81 |
| -<ins>and converted to `intmax_t`</ins> |
82 |
| -). |
83 |
| -</td> |
84 |
| -</tr> |
85 |
| -</tbody> |
86 |
| -</table> |
| 95 | +<pre><code> |
| 96 | +namespace std { |
| 97 | + template<class Rep, class Period, class charT> |
| 98 | + <ins>requires formattable<Rep, charT></ins> |
| 99 | + struct formatter<chrono::duration<Rep, Period>, charT>; |
| 100 | + template<class Duration, class charT> |
| 101 | + struct formatter<chrono::sys_time<Duration>, charT>; |
| 102 | +</code></pre> |
87 | 103 | </blockquote>
|
88 | 104 | </li>
|
89 | 105 | </ol>
|
|
0 commit comments