Skip to content

Commit 1e5881f

Browse files
committed
New proposed resolution for 4118
1 parent 19c8908 commit 1e5881f

File tree

1 file changed

+35
-19
lines changed

1 file changed

+35
-19
lines changed

xml/issue4118.xml

Lines changed: 35 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<section><sref ref="[time.format]"/></section>
77
<submitter>Jonathan Wakely</submitter>
88
<date>08 Jul 2024</date>
9-
<priority>99</priority>
9+
<priority>3</priority>
1010

1111
<discussion>
1212
<p>
@@ -58,32 +58,48 @@ which we know how to format?
5858
This is somewhat related to issue <iref ref="953"/>, since it's unclear
5959
which operations "a class emulating an arithmetic type" needs to support.
6060
</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&lt;long double&gt;</code> and could overflow for
70+
<code>duration&lt;BigInt&gt;</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&lt;char&gt;</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&lt;&lt;</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+
6185
</discussion>
6286

6387
<resolution>
6488
<p>
65-
This wording is relative to <paper num="N4981"/>.
89+
This wording is relative to <paper num="N4986"/>.
6690
</p>
6791
<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>
6993

7094
<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>&hellip;</td><td>&hellip;</td><td>&hellip;</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&lt;class Rep, class Period, class charT&gt;
98+
<ins>requires formattable&lt;Rep, charT&gt;</ins>
99+
struct formatter&lt;chrono::duration&lt;Rep, Period&gt;, charT&gt;;
100+
template&lt;class Duration, class charT&gt;
101+
struct formatter&lt;chrono::sys_time&lt;Duration&gt;, charT&gt;;
102+
</code></pre>
87103
</blockquote>
88104
</li>
89105
</ol>

0 commit comments

Comments
 (0)