<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Issue 954: Various threading bugs #4</title>
<meta property="og:title" content="Issue 954: Various threading bugs #4">
<meta property="og:description" content="C++ library issue. Status: C++11">
<meta property="og:url" content="https://cplusplus.github.io/LWG/issue954.html">
<meta property="og:type" content="website">
<meta property="og:image" content="http://cplusplus.github.io/LWG/images/cpp_logo.png">
<meta property="og:image:alt" content="C++ logo">
<style>
  p {text-align:justify}
  li {text-align:justify}
  pre code.backtick::before { content: "`" }
  pre code.backtick::after { content: "`" }
  blockquote.note
  {
    background-color:#E0E0E0;
    padding-left: 15px;
    padding-right: 15px;
    padding-top: 1px;
    padding-bottom: 1px;
  }
  ins {background-color:#A0FFA0}
  del {background-color:#FFA0A0}
  table.issues-index { border: 1px solid; border-collapse: collapse; }
  table.issues-index th { text-align: center; padding: 4px; border: 1px solid; }
  table.issues-index td { padding: 4px; border: 1px solid; }
  table.issues-index td:nth-child(1) { text-align: right; }
  table.issues-index td:nth-child(2) { text-align: left; }
  table.issues-index td:nth-child(3) { text-align: left; }
  table.issues-index td:nth-child(4) { text-align: left; }
  table.issues-index td:nth-child(5) { text-align: center; }
  table.issues-index td:nth-child(6) { text-align: center; }
  table.issues-index td:nth-child(7) { text-align: left; }
  table.issues-index td:nth-child(5) span.no-pr { color: red; }
  @media (prefers-color-scheme: dark) {
     html {
        color: #ddd;
        background-color: black;
     }
     ins {
        background-color: #225522
     }
     del {
        background-color: #662222
     }
     a {
        color: #6af
     }
     a:visited {
        color: #6af
     }
     blockquote.note
     {
        background-color: rgba(255, 255, 255, .10)
     }
  }
</style>
</head>
<body>
<hr>
<p><em>This page is a snapshot from the LWG issues list, see the <a href="lwg-active.html">Library Active Issues List</a> for more information and the meaning of <a href="lwg-active.html#C++11">C++11</a> status.</em></p>
<h3 id="954"><a href="lwg-defects.html#954">954</a>. Various threading bugs #4</h3>
<p><b>Section:</b> 30.3 <a href="https://wg21.link/time.clock.req">[time.clock.req]</a> <b>Status:</b> <a href="lwg-active.html#C++11">C++11</a>
 <b>Submitter:</b> Pete Becker <b>Opened:</b> 2009-01-07 <b>Last modified:</b> 2016-01-28</p>
<p><b>Priority: </b>Not Prioritized
</p>
<p><b>View all other</b> <a href="lwg-index.html#time.clock.req">issues</a> in [time.clock.req].</p>
<p><b>View all issues with</b> <a href="lwg-status.html#C++11">C++11</a> status.</p>
<p><b>Discussion:</b></p>
<p>
Table 55 &mdash; Clock Requirements (in 30.3 <a href="https://wg21.link/time.clock.req">[time.clock.req]</a>)
</p>

<ol style="list-style-type:lower-alpha">
<li>
the requirements for <code>C1::time_point</code> require <code>C1</code> and <code>C2</code>
to "refer to the same epoch", but "epoch" is not defined.
</li>
<li>
"Different clocks may share a <code>time_point</code> definition if it is
valid to compare their <code>time_point</code>s by comparing their
respective <code>duration</code>s." What does "valid" mean here? And, since
<code>C1::rep</code> is "<em>THE</em> representation type of the native
<code>duration</code> and <code>time_point</code>" (emphasis added), there
doesn't seem to be much room for some other representation.
</li>
<li>
<code>C1::is_monotonic</code> has type "<code>const bool</code>". The
"<code>const</code>" should be removed.
</li>
<li>
<code>C1::period</code> has type <code>ratio</code>. <code>ratio</code> isn't a type, 
it's a template. What is the required type?
</li>
</ol>

<p><i>[
2009-05-10 Howard adds:
]</i></p>


<ol style="list-style-type:lower-alpha">
<li>
<p>
"epoch" is purposefully not defined beyond the common English
<a href="http://definitions.dictionary.net/epoch">definition</a>.  The C standard
also chose not to define epoch, though POSIX did.  I believe it is a strength
of the C standard that epoch is not defined.  When it is known that two <code>time_point</code>s
refer to the same epoch, then a definition of the epoch is not needed to compare
the two <code>time_point</code>s, or subtract them.
</p>
<p>
A <code>time_point</code> and a <code>Clock</code> implicitly refer to an (unspecified) epoch.
The <code>time_point</code> represents an offset (<code>duration</code>) from an epoch.
</p>
</li>
<li>
<p>
The sentence:
</p>
<blockquote><p>
Different clocks 
may share a <code>time_point</code>
definition if it is valid to 
compare their <code>time_point</code>s by 
comparing their respective 
<code>duration</code>s.
</p></blockquote>

<p>
is redundant and could be removed.  I believe the sentence which follows the above:
</p>

<blockquote><p>
<code>C1</code> and <code>C2</code> shall refer to the same epoch.
</p></blockquote>

<p>
is sufficient.  If two clocks share the same epoch, then by definition, comparing
their <code>time_point</code>s is valid.
</p>
</li>
<li>
<code>is_monotonic</code> is meant to never change (be <code>const</code>).  It is also
desired that this value be usable in compile-time computation and branching.
</li>
<li>
<p>
This should probably instead be worded:
</p>
<blockquote><p>
An instantiation of <code>ratio</code>.
</p></blockquote>
</li>
</ol>

<p><i>[
Batavia (2009-05):
]</i></p>

<blockquote>
<p>
Re (a): It is not clear to us whether "epoch" is a term of art.
</p>
<p>
Re (b), (c), and (d):  We agree with Howard's comments,
and would consider adding to (c) a <code>static constexpr</code> requirement.
</p>
<p>
Move to Open pending proposed wording.
</p>
</blockquote>

<p><i>[
2009-05-25 Daniel adds:
]</i></p>


<blockquote><p>
In regards to (d) I suggest to say "a specialization of ratio" instead of
"An instantiation of ratio". This seems to be the better matching standard
core language term for this kind of entity.
</p></blockquote>

<p><i>[
2009-05-25 Ganesh adds:
]</i></p>


<blockquote>
<p>
Regarding (a), I found this paper on the ISO website using the term "epoch" consistently with the current wording:
</p>

<p>
<a href="http://standards.iso.org/ittf/PubliclyAvailableStandards/C030811e_FILES/MAIN_C030811e/text/ISOIEC_18026E_TEMPORAL_CS.HTM">http://standards.iso.org/ittf/PubliclyAvailableStandards/C030811e_FILES/MAIN_C030811e/text/ISOIEC_18026E_TEMPORAL_CS.HTM</a>
</p>
<p>
which is part of ISO/IEC 18026 "Information technology -- Spatial Reference Model (SRM)".
</p>
</blockquote>

<p><i>[
2009-08-01 Howard: Moved to Reivew as the wording requested in Batavia has been provided.
]</i></p>


<p><i>[
2009-10 Santa Cruz:
]</i></p>


<blockquote><p>
Move to Ready.
</p></blockquote>



<p id="res-954"><b>Proposed resolution:</b></p>
<ol>
<li>
<p>
Change 30.3 <a href="https://wg21.link/time.clock.req">[time.clock.req]</a> p1:
</p>
<blockquote><p>
-1- A clock is a bundle consisting of a native <code>duration</code>, a native <code>time_point</code>, and a function <code>now()</code> to get the 
current <code>time_point</code>.  <ins>The origin of the clock's <code>time_point</code> is referred to as the clock's <i>epoch</i> as defined in 
section 6.3 of ISO/IEC 18026.</ins>
A clock shall meet the requirements in Table 45.
</p></blockquote>
</li>
<li>
<p>
Remove the sentence from the <code>time_point</code> row of the table "Clock Requirements":
</p>
<table border="1">
<caption>Clock requirements</caption>
<tr>
<td>
<code>C1::time_point</code>
</td>
<td>
<code>chrono::time_point&lt;C1&gt;</code> or <code>chrono::time_point&lt;C2, C1::duration&gt;</code>
</td>
<td>
The native <code>time_point</code> type of the clock.
<del>Different clocks may share a <code>time_point</code> definition if it is valid to compare their <code>time_point</code>s by comparing their respective <code>duration</code>s.</del>
<code>C1</code> and <code>C2</code> shall refer to the same epoch.
</td>
</tr>
</table>
</li>
<li>
<p>
Change the row starting with <code>C1::period</code> of the table "Clock Requirements":
</p>
<table border="1">
<caption>Clock requirements</caption>
<tr>
<td>
<code>C1::period</code>
</td>
<td>
<ins>a specialization of</ins> <code>ratio</code>
</td>
<td>
The tick period of the clock in seconds.
</td>
</tr>
</table>

</li>
</ol>





</body>
</html>
