|
Boost-Commit : |
From: bdawes_at_[hidden]
Date: 2007-12-05 22:38:44
Author: bemandawes
Date: 2007-12-05 22:38:44 EST (Wed, 05 Dec 2007)
New Revision: 41772
URL: http://svn.boost.org/trac/boost/changeset/41772
Log:
Lots of fixes and tweaks. Reorganization to conform with the usual order of subclauses. First pass through non-member functions complete. Second pass through Duration table complete.
Text files modified:
sandbox/committee/branches/date_time/thread_library.html | 1064 ++++++++++++++++++++++-----------------
1 files changed, 598 insertions(+), 466 deletions(-)
Modified: sandbox/committee/branches/date_time/thread_library.html
==============================================================================
--- sandbox/committee/branches/date_time/thread_library.html (original)
+++ sandbox/committee/branches/date_time/thread_library.html 2007-12-05 22:38:44 EST (Wed, 05 Dec 2007)
@@ -26,7 +26,7 @@
<body>
-<h1>Multi-threading Library for Standard C++</h1>
+<h1>Multi-threading Library for Standard C++ (Revision 1)</h1>
<p>
ISO/IEC JTC1 SC22 WG21 N???? = 07-???? - 2007-12-04
@@ -95,14 +95,15 @@
<br> 30.4.2 Class condition_variable_any [thread.condvarany]
<br>Chapter 31 Date Time Library [time]
<br> 31.1 Duration Requirements [time.duration.requirements]
-<br> 31.2 Class system_time [time.system]
-<br> 31.3 Function get_system_time [time.getsystem]
-<br> 31.4 Class nanoseconds [time.nanoseconds]
-<br> 31.5 Class microseconds [time.microseconds]
-<br> 31.6 Class milliseconds [time.milliseconds]
-<br> 31.7 Class seconds [time.seconds]
-<br> 31.8 Class minutes [time.minutes]
-<br> 31.9 Class hours [time.hours]
+<br> 31.2 Class nanoseconds [time.nanoseconds]
+<br> 31.3 Class microseconds [time.microseconds]
+<br> 31.4 Class milliseconds [time.milliseconds]
+<br> 31.5 Class seconds [time.seconds]
+<br> 31.6 Class minutes [time.minutes]
+<br> 31.7 Class hours [time.hours]
+<br> 31.8 Class system_time [time.system]
+<br> <a href="#time.nonmembers">31.9 Non-member functions
+[time.nonmembers]</a>
<br>References
<br>Acknowledgments
</p>
@@ -3468,15 +3469,37 @@
class microseconds;
class nanoseconds;
-// <em>timepoint</em>
+// <em>timepoint type</em>
class system_time;
-// <em>functions</em>
+// <em>non-member functions </em></code>[time.nonmembers]<code>
system_time get_system_time();
+template <class LhsDuration, class RhsDuration>
+ bool operator==(const LhsDuration& lhs, const RhsDuration& rhs);
+template <class LhsDuration, class RhsDuration>
+ bool operator!=(const LhsDuration& lhs, const RhsDuration& rhs);
+
+template <class LhsDuration, class RhsDuration>
+ bool operator< (const LhsDuration& lhs, const RhsDuration& rhs);
+template <class LhsDuration, class RhsDuration>
+ bool operator<=(const LhsDuration& lhs, const RhsDuration& rhs);
+template <class LhsDuration, class RhsDuration>
+ bool operator> (const LhsDuration& lhs, const RhsDuration& rhs);
+template <class LhsDuration, class RhsDuration>
+ bool operator>=(const LhsDuration& lhs, const RhsDuration& rhs);
+
+template <class LhsDuration, class RhsDuration>
+ <i>FRDuration</i> operator+(const LhsDuration& lhs, const RhsDuration& rhs)
+template <class LhsDuration, class RhsDuration>
+ <i>FRDuration</i> operator-(const LhsDuration& lhs, const RhsDuration& rhs)
} // std</code></pre>
</blockquote>
+<p>Types denoted as <i><code>FRDuration</code> </i>are the type with the finest
+resolution of <code>LhsDuration</code> and <code>RhsDuration</code>. If their
+resolutions are the same, <i><code>FRDuration</code> </i>is <code>LhsDuration</code>.</p>
+
<h3><a name="time.duration.requirements">31.1 Duration requirements
[time.duration.requirements]</a></h3>
<p>This subclause describes requirements on duration types used to instantiate
@@ -3534,17 +3557,21 @@
</tr>
<tr>
<td valign="top" width="25%"><code>d -= e</code></td>
- <td valign="top" width="11%"><code>D</code></td>
+ <td valign="top" width="11%"><code>D&</code></td>
<td valign="top" width="39%"><i>Postcondition:</i><code> d.tick_count ==
d.tick_count()</code><sub>at-entry</sub><code>-x</code>, where <code>x</code>
- is <code>e.tick_count()</code> converted to the resolution of <code>D</code>.</td>
+ is <code>e.tick_count()</code> converted to the resolution of <code>D</code>.<br>
+ <i>Remarks:</i> The resolution of <code>E</code> shall not be finer than the
+ resolution of <code>D</code>. A diagnostic is required.</td>
</tr>
<tr>
<td valign="top" width="25%"><code>d += e</code></td>
- <td valign="top" width="11%"><code>D</code></td>
+ <td valign="top" width="11%"><code>D&</code></td>
<td valign="top" width="39%"><i>Postcondition:</i><code> d.tick_count ==
d.tick_count()</code><sub>at-entry</sub><code>+x</code>, where <code>x</code>
- is <code>e.tick_count()</code> converted to the resolution of <code>D</code>.</td>
+ is <code>e.tick_count()</code> converted to the resolution of <code>D</code>.<i><br>
+ Remarks:</i> The resolution of <code>E</code> shall not be finer than the
+ resolution of <code>D</code>. A diagnostic is required.</td>
</tr>
<tr>
<td valign="top" width="25%"><code>d / c</code></td>
@@ -3553,7 +3580,7 @@
</tr>
<tr>
<td valign="top" width="25%"><code>d /= c</code></td>
- <td valign="top" width="11%"><code>D</code></td>
+ <td valign="top" width="11%"><code>D&</code></td>
<td valign="top" width="39%"><i>Postcondition:</i> <code>d.tick_count() ==
d.tick_count()</code><sub>at-entry</sub><code>/c</code></td>
</tr>
@@ -3564,155 +3591,150 @@
</tr>
<tr>
<td valign="top" width="25%"><code>d *= c</code></td>
- <td valign="top" width="11%"><code>D</code></td>
+ <td valign="top" width="11%"><code>D&</code></td>
<td valign="top" width="39%"><i>Postcondition:</i> <code>d.tick_count()
== d.tick_count()</code><sub>at-entry</sub><code>*c</code></td>
</tr>
</table>
-<p>Unless otherwise specified, no functions specified for duration types shall throw
+<p>Unless otherwise specified, no duration type functions shall throw
exceptions.</p>
-<h3><a name="time.system">31.2 Class system_time [time.system]</a></h3>
-<p>
-The class <code>system_time</code> provides a time point
-that represents the current
-Coordinated Universal Time, known as UTC, time.
-<code>system_time</code>
-shall provide an epoch time of 1970-01-01 00:00:00.000000000
-and a maximum time value of at least epoch time + 292 years.
-</p>
+<h3><a name="time.nanoseconds">32.2 Class nanoseconds [time.nanoseconds]</a></h3>
<p>
-<b>[Crowl:
-I hope I'm not getting too pedantic here,
-but I'd recommend encuraging a "system time" based on UTC
-rather than on defining it so.
-The reason is that embedded systems
-need to function independent of the global time system
-when lives are at stake.
-I don't want the flight control software dependent on UTC.
-]</b>
-</p>
+Objects of class <code>nanoseconds</code> can be used to represent a count of nanoseconds.
+Class <code>nanoseconds</code> shall be a duration type ([time.duration.requirements]).
+For the sake of exposition, the semantics of member functions are not described
+if they have the same apparent semantics as those specified for duration types.</p>
<blockquote>
<pre><code>
-class system_time
+class nanoseconds
{
public:
+ // <em>traits information</em>
+ typedef <var><strong>implementation-defined</strong></var> tick_type;
+ static const tick_type ticks_per_second = 1000000000;
+ static const tick_type seconds_per_tick = 0;
+ static const bool is_subsecond = true;
- system_time();
- system_time(time_t, nanoseconds ns);
- ~system_time();
-
- time_t seconds_since_epoch() const;
- nanoseconds nanoseconds_since_epoch() const;
-
- // <em>traits</em>
- typedef 'implementation defined' tick_type;
- static tick_type ticks_per_second();
- static tick_type seconds_per_tick();
- static bool is_subsecond();
-
- // <em>comparison functions</em>
- bool operator==(const system_time& rhs) const;
- bool operator!=(const system_time& rhs) const;
- bool operator>(const system_time& rhs) const;
- bool operator>=(const system_time& rhs) const;
- bool operator<(const system_time& rhs) const;
- bool operator<=(const system_time& rhs) const;
-
- // <em>arithmetic functions</em>
- nanoseconds operator-(const system_time& rhs) const
-
- template<typename Duration>
- system_time operator+(const Duration& td) const;
-
- template<typename Duration>
- system_time& operator+=(const Duration& td);
+ // <i>construct/copy/destroy functions</i>
+ nanoseconds(long long ns=0);
+ nanoseconds(const nanoseconds&);
+ nanoseconds(nanosecons&&);
+ nanoseconds& operator=(const nanoseconds&);
+ nanoseconds& operator=(nanoseconds&&);
+ ~nanoseconds();
- template<typename Duration>
- system_time operator-(const Duration& td) const;
+ // <em>observer functions</em>
+ tick_type get_count() const;
- template<typename Duration>
- system_time& operator-=(const Duration& td)
+<i> // modifier functions</i>
+ template<typename RhsDuration>
+ nanoseconds& operator-=(const RhsDuration& d);
+ template<typename RhsDuration>
+ nanoseconds& operator+=(const RhsDuration& d);
+ nanoseconds& operator*=(long multiplier);
+ nanoseconds& operator/=(long divisor);
-};
-</code></pre>
+ // <i>operations</i>
+ nanoseconds operator-() const;
+ nanoseconds operator*(long multiplier) const;
+ nanoseconds operator/(long divisor) const;
+};</code></pre>
</blockquote>
-<p>
-[<i>Note:</i>
-292 years represents the number of nanoseconds
-that can be represented in a signed 64 bit integer.
-—<i>end note</i>]
-</p>
-
-<p>Unless otherwise specified, no
-<code>system_time</code> member functions shall throw
-exceptions.</p>
-
<pre><code>
-system_time();
-</code></pre>
+nanoseconds(long long ns=0);</code></pre>
<blockquote>
<dl>
<dt>Effects:</dt>
<dd>
-Constructs a system_time
-object representing the epoch time point 1970-01-01 00:00:00.000000000
+Constructs an object of type <code>nanoseconds</code>.
</dd>
+<dt>Postcondition:</dt>
+<dd><code>get_count() == ns;</code></dd>
</dl>
</blockquote>
+<h3><code><br>
+</code><a name="time.microseconds">32.3 Class microseconds [time.microseconds]</a></h3>
+
+<p>
+Objects of class <code>microseconds</code>
+can be used to represent a count of microseconds. Class <code>microseconds</code>
+shall be a duration type ([time.duration.requirements]). For the sake of
+exposition, the semantics of member functions are not described if they have the
+same apparent semantics as those specified for duration types.</p>
+
+<blockquote>
<pre><code>
-system_time(time_t secs, nanoseconds ns);
+class microseconds
+{
+public:
+
+ microseconds(long long=0);
+ microseconds(const microseconds& rhs);
+ ~microseconds();
+
+ // <em>conversions</em>
+ operator nanoseconds() const
+
+ // <em>traits information</em>
+ static tick_type ticks_per_second();
+ static tick_type seconds_per_tick();
+ static bool is_subsecond();
+ typedef <var><strong>implementation-defined</strong></var> tick_type;
+
+ // <em>+ common functions</em>
+
+};
+
+</code></pre>
+</blockquote>
+
+<pre><code>
+microseconds(long long=0);
</code></pre>
<blockquote>
<dl>
<dt>Effects:</dt>
<dd>
-Construct<var>s</var> a utc
-time object representing the time point
-that is secs + 1,000,000,000*ns after the epoch.
-</dd>
-
-<dt>Remarks:</dt>
-<dd>
-If the total nanoseconds > 1 second the seconds are
-incremented appropriately.
+Constructs an object with a count of microseconds - default
+is zero.
</dd>
</dl>
</blockquote>
<pre><code>
-time_t seconds_since_epoch() const;
+microseconds(const microseconds& rhs);
</code></pre>
<blockquote>
<dl>
-<dt>Returns:</dt>
+<dt>Effects:</dt>
<dd>
-The count of seconds since 1970-01-01 00:00:00.
+Copy construction.
</dd>
</dl>
</blockquote>
<pre><code>
-nanoseconds nanoseconds_since_epoch() const;
+// <em>conversions</em>
+operator nanoseconds() const
</code></pre>
<blockquote>
<dl>
<dt>Returns:</dt>
<dd>
-The count of nanoseconds
-since 1970-01-01 00:00:00.
+microsecond count converted to nanoseconds
</dd>
</dl>
@@ -3726,7 +3748,7 @@
<dl>
<dt>Returns:</dt>
<dd>
-1000000000
+1000000
</dd>
</dl>
@@ -3754,312 +3776,315 @@
<dl>
<dt>Returns:</dt>
<dd>
-true.
+true
</dd>
</dl>
</blockquote>
-<pre><code>
-bool operator==(const system_time& rhs) const;
-</code></pre>
+<h3><a name="time.milliseconds">32.4 Class milliseconds [time.milliseconds]</a></h3>
+
+<p>
+Objects of class <code>milliseconds</code>
+can be used to represent a count of milliseconds. Class <code>milliseconds</code>
+shall be a duration type ([time.duration.requirements]). For the sake of
+exposition, the semantics of member functions are not described if they have the
+same apparent semantics as those specified for duration types.</p>
<blockquote>
-<dl>
-<dt>Returns:</dt>
-<dd>
-True if
-the time
-represented by <code>*this</code> is equal to the time represented by <var>rhs</var>.
-</dd>
+<pre><code>
+class milliseconds
+{
+public:
+ milliseconds(long long=0);
+ milliseconds(const milliseconds& rhs);
+ ~milliseconds();
-</dl>
+ // <em>conversions</em>
+ operator nanoseconds() const;
+ operator microseconds() const;
+
+ // <em>traits information</em>
+ static tick_type ticks_per_second();
+ static tick_type seconds_per_tick();
+ static bool is_subsecond();
+ typedef <var><strong>implementation-defined</strong></var> tick_type;
+
+ // <em>+ common functions</em>
+};
+</code></pre>
</blockquote>
<pre><code>
-bool operator!=(const system_time& rhs) const;
+milliseconds(long long=0);
</code></pre>
<blockquote>
<dl>
-<dt>Returns:</dt>
+<dt>Effects:</dt>
<dd>
-True if the time represented by <code>*this</code> is not equal to the time represented
-by <var>rhs</var>.
+Constructs an object with a count of milliseconds - default
+is zero.
</dd>
</dl>
</blockquote>
<pre><code>
-bool operator>(const system_time& rhs) const;
+milliseconds(const milliseconds& rhs);
</code></pre>
<blockquote>
<dl>
-<dt>Returns:</dt>
+<dt>Effects:</dt>
<dd>
-True if time represented by
-<code>*this</code> is greater than the time represented by <var>rhs</var>.
+Copy construction.
</dd>
</dl>
</blockquote>
<pre><code>
-bool operator>=(const system_time& rhs) const;
+operator nanoseconds() const
</code></pre>
<blockquote>
<dl>
<dt>Returns:</dt>
<dd>
-True if time represented
-by <code>*this</code> is greater or equal than the time represented by <var>rhs</var>.
+millisecond count converted to nanoseconds
</dd>
</dl>
</blockquote>
<pre><code>
-bool operator<(const system_time& rhs) const;
+operator microseconds() const
</code></pre>
<blockquote>
<dl>
<dt>Returns:</dt>
<dd>
-True if time represented by <code>*this</code>
-is less than the time represented by <var>rhs</var>.
+millisecond count converted to microseconds
</dd>
</dl>
</blockquote>
<pre><code>
-bool operator<=(const system_time& rhs) const;
+static tick_type ticks_per_second();
</code></pre>
<blockquote>
<dl>
<dt>Returns:</dt>
<dd>
-True if time represented by <code>*this</code>
-is less or equal than the time represented by <var>rhs</var>.
+1000
</dd>
</dl>
</blockquote>
<pre><code>
-nanoseconds operator-(const system_time& <var>rhs</var>) const
+static tick_type seconds_per_tick();
</code></pre>
<blockquote>
<dl>
<dt>Returns:</dt>
<dd>
-The difference in nanoseconds between
-the time represented by <code>*this</code> and
-the time represented by <code><var>rhs</var></code>.
-</dd>
-
-<dt>Remarks:</dt>
-<dd>
-If rhs is greater the result will be a negative nanosecond.
-count.
+0
</dd>
</dl>
</blockquote>
<pre><code>
-template<typename Duration>
-system_time operator+(const Duration& td) const;
+static bool is_subsecond();
</code></pre>
<blockquote>
<dl>
<dt>Returns:</dt>
<dd>
-The duration converted to nanosecond resolution
-and added to the time represented by <code>*this</code>.
+true
</dd>
</dl>
</blockquote>
-<pre><code>
-template<typename Duration>
-system_time& operator+=(const Duration& td);
+<h3><a name="time.seconds">32.5 Class seconds [time.seconds]</a></h3>
+
+<p>
+Objects of class <code>seconds</code>
+can be used to represent a count of seconds. Class <code>seconds</code> shall be
+a duration type ([time.duration.requirements]). For the sake of exposition, the
+semantics of member functions are not described if they have the same apparent
+semantics as those specified for duration types.</p>
+
+<blockquote>
+<pre><code>
+class seconds
+{
+public:
+ seconds(long long s=0);
+ seconds(const seconds& rhs);
+ ~seconds();
+
+ // <em>conversions</em>
+ operator nanoseconds() const
+ operator microseconds() const
+ operator milliseconds() const
+
+ // <em>traits information</em>
+ static tick_type ticks_per_second();
+ static tick_type seconds_per_tick();
+ static bool is_subsecond();
+ typedef <var><strong>implementation-defined</strong></var> tick_type;
+
+ // <em>+ common functions</em>
+
+};
+</code></pre>
+</blockquote>
+
+<pre><code>
+seconds(long long=0);
</code></pre>
<blockquote>
<dl>
<dt>Effects:</dt>
<dd>
-Convert the duration to nanosecond resolution
-and add it to the time represented by <code>*this</code>.
+Construct<var>s</var> an object with a count of seconds - default is
+zero.
</dd>
-<dt>Returns:</dt>
+</dl>
+</blockquote>
+
+<pre><code>
+seconds(const seconds& rhs);
+</code></pre>
+
+<blockquote>
+<dl>
+<dt>Effects:</dt>
<dd>
-Modified value of this.
-<b>[Crowl: not a reference to this?]</b>
+Copy construction.
</dd>
</dl>
</blockquote>
<pre><code>
-template<typename Duration>
-system_time operator-(const Duration& td) const;
+operator nanoseconds() const
</code></pre>
<blockquote>
<dl>
<dt>Returns:</dt>
<dd>
-The duration converted to nanosecond resolution
-and subtracted from the time represented by <code>*this</code>.
+second count converted to nanoseconds
</dd>
</dl>
</blockquote>
<pre><code>
-template<typename Duration>
-system_time& operator-=(const Duration& td)
+operator microseconds() const
</code></pre>
<blockquote>
<dl>
-<dt>Effects:</dt>
-<dd>
-Convert the duration to nanosecond resolution
-and subtract it from the time represented by <code>*this</code>.
-</dd>
-
<dt>Returns:</dt>
<dd>
-Modified value of this.
+second count converted to microseconds
</dd>
</dl>
</blockquote>
-
-<h3><a name="time.getsystem">32.3 Function get_system_time [time.getsystem]</a></h3>
-
-<p>
-The function <code>get_system_time</code>
-provides access to the system clock at a
-resolution up to nanoseconds.
-The actual resolution may vary from platform to platform.
-</p>
-
<pre><code>
-system_time get_system_time();</code></pre>
+operator milliseconds() const
+</code></pre>
<blockquote>
<dl>
-
<dt>Returns:</dt>
<dd>
-The system time ([time.system]) as provided by the operating system.</dd>
-
-<dt>Throws:</dt>
-<dd>
-<code>system_error</code>
-([syserr.syserr]) if unable to return the specified value. The conditions for
-which this might occur are implementation defined.</dd>
+second count converted to milliseconds
+</dd>
</dl>
</blockquote>
-
-<h3><a name="time.nanoseconds">32.4 Class nanoseconds [time.nanoseconds]</a></h3>
-
-<p>
-Objects of class <code>nanoseconds</code> can be used to represent a count of nanoseconds.
-Class <code>nanoseconds</code> shall be a duration type ([time.duration.requirements]).
-For the sake of exposition, the semantics of member functions are not described
-if they have the same apparent semantics as those specified for duration types.</p>
+<pre><code>
+static tick_type ticks_per_second();
+</code></pre>
<blockquote>
-<pre><code>
-class nanoseconds
-{
-public:
- // <em>traits information</em>
- typedef <var><strong>implementation-defined</strong></var> tick_type;
- static const tick_type ticks_per_second = 1000000000;
- static const tick_type seconds_per_tick = 0;
- static const bool is_subsecond = true;
+<dl>
+<dt>Returns:</dt>
+<dd>
+1
+</dd>
- // <i>construct/copy/destroy functions</i>
- nanoseconds(long long ns=0);
- nanoseconds(const nanoseconds&);
- nanoseconds(nanosecons&&);
- nanoseconds& operator=(const nanoseconds&);
- nanoseconds& operator=(nanoseconds&&);
- ~nanoseconds();
+</dl>
+</blockquote>
- // <em>observer functions</em>
- tick_type get_count() const;
+<pre><code>
+static tick_type seconds_per_tick();
+</code></pre>
-<i> // modifier functions</i>
- template<typename RhsDuration>
- nanoseconds& operator-=(const RhsDuration& d);
- template<typename RhsDuration>
- nanoseconds& operator+=(const RhsDuration& d);
- nanoseconds& operator/=(int divisor);
- nanoseconds& operator*=(int multiplier);
+<blockquote>
+<dl>
+<dt>Returns:</dt>
+<dd>
+1
+</dd>
- // <i>operations</i>
- nanoseconds operator-() const;
- nanoseconds operator*(int multiplier) const;
- nanoseconds operator/(int divisor) const;
-};</code></pre>
+</dl>
</blockquote>
<pre><code>
-nanoseconds(long long ns=0);</code></pre>
+static bool is_subsecond();
+</code></pre>
<blockquote>
<dl>
-<dt>Effects:</dt>
+<dt>Returns:</dt>
<dd>
-Constructs an object of type <code>nanoseconds</code>.
+false
</dd>
-<dt>Postcondition:</dt>
-<dd><code>get_count() == ns;</code></dd>
</dl>
</blockquote>
-<pre><code>
-</code><a name="time.microseconds">32.5 Class microseconds [time.microseconds]</a></pre>
+<h3><a name="time.minutes">32.6 Class minutes [time.minutes]</a></h3>
<p>
-Objects of class <code>microseconds</code>
-can be used to represent a count of microseconds. Class <code>microseconds</code>
-shall be a duration type ([time.duration.requirements]). For the sake of
-exposition, the semantics of member functions are not described if they have the
-same apparent semantics as those specified for duration types.</p>
+Objects of class <code>minutes</code>
+can be used to represent a count of minutes. Class <code>minutes</code> shall be
+a duration type ([time.duration.requirements]). For the sake of exposition, the
+semantics of member functions are not described if they have the same apparent
+semantics as those specified for duration types.</p>
<blockquote>
<pre><code>
-class microseconds
+class minutes
{
public:
-
- microseconds(long long=0);
- microseconds(const microseconds& rhs);
- ~microseconds();
+ minutes(long long s=0);
+ minutes(const minutes& rhs);
+ ~minutes();
// <em>conversions</em>
operator nanoseconds() const
+ operator microseconds() const
+ operator milliseconds() const
+ operator seconds() const
// <em>traits information</em>
static tick_type ticks_per_second();
@@ -4070,27 +4095,26 @@
// <em>+ common functions</em>
};
-
</code></pre>
</blockquote>
<pre><code>
-microseconds(long long=0);
+minutes(long long=0);
</code></pre>
<blockquote>
<dl>
<dt>Effects:</dt>
<dd>
-Constructs an object with a count of microseconds - default
-is zero.
+Construct<var>s</var> an object with a count of minutes - default is
+zero.
</dd>
</dl>
</blockquote>
<pre><code>
-microseconds(const microseconds& rhs);
+minutes(const minutes& rhs);
</code></pre>
<blockquote>
@@ -4104,7 +4128,6 @@
</blockquote>
<pre><code>
-// <em>conversions</em>
operator nanoseconds() const
</code></pre>
@@ -4112,7 +4135,49 @@
<dl>
<dt>Returns:</dt>
<dd>
-microsecond count converted to nanoseconds
+minute count converted to nanoseconds
+</dd>
+
+</dl>
+</blockquote>
+
+<pre><code>
+operator microseconds() const
+</code></pre>
+
+<blockquote>
+<dl>
+<dt>Returns:</dt>
+<dd>
+minute count converted to microseconds
+</dd>
+
+</dl>
+</blockquote>
+
+<pre><code>
+operator milliseconds() const
+</code></pre>
+
+<blockquote>
+<dl>
+<dt>Returns:</dt>
+<dd>
+minute count converted to milliseconds
+</dd>
+
+</dl>
+</blockquote>
+
+<pre><code>
+operator seconds() const
+</code></pre>
+
+<blockquote>
+<dl>
+<dt>Returns:</dt>
+<dd>
+minute count converted to seconds
</dd>
</dl>
@@ -4126,7 +4191,7 @@
<dl>
<dt>Returns:</dt>
<dd>
-1000000
+0
</dd>
</dl>
@@ -4140,7 +4205,7 @@
<dl>
<dt>Returns:</dt>
<dd>
-0
+60
</dd>
</dl>
@@ -4154,33 +4219,36 @@
<dl>
<dt>Returns:</dt>
<dd>
-true
+false
</dd>
</dl>
</blockquote>
-<h3><a name="time.milliseconds">32.6 Class milliseconds [time.milliseconds]</a></h3>
+<h3><a name="time.hours">31.7 Class hours [time.hours]</a></h3>
<p>
-Objects of class <code>milliseconds</code>
-can be used to represent a count of milliseconds. Class <code>milliseconds</code>
-shall be a duration type ([time.duration.requirements]). For the sake of
-exposition, the semantics of member functions are not described if they have the
-same apparent semantics as those specified for duration types.</p>
+Objects of class <code>hours</code>
+can be used to represent a count of hours. Class <code>hours</code> shall be a
+duration type ([time.duration.requirements]). For the sake of exposition, the
+semantics of member functions are not described if they have the same apparent
+semantics as those specified for duration types.</p>
<blockquote>
<pre><code>
-class milliseconds
+class hours
{
public:
- milliseconds(long long=0);
- milliseconds(const milliseconds& rhs);
- ~milliseconds();
+ hours(long long s=0);
+ hours(const hours& rhs);
+ ~hours();
// <em>conversions</em>
- operator nanoseconds() const;
- operator microseconds() const;
+ operator nanoseconds() const
+ operator microseconds() const
+ operator milliseconds() const
+ operator seconds() const
+ operator minutes() const
// <em>traits information</em>
static tick_type ticks_per_second();
@@ -4189,27 +4257,27 @@
typedef <var><strong>implementation-defined</strong></var> tick_type;
// <em>+ common functions</em>
+
};
</code></pre>
</blockquote>
<pre><code>
-milliseconds(long long=0);
+hours(long long=0);
</code></pre>
<blockquote>
<dl>
<dt>Effects:</dt>
<dd>
-Constructs an object with a count of milliseconds - default
-is zero.
+Construct<var>s</var> an object with a count of hours - default is zero.
</dd>
</dl>
</blockquote>
<pre><code>
-milliseconds(const milliseconds& rhs);
+hours(const hours& rhs);
</code></pre>
<blockquote>
@@ -4230,21 +4298,61 @@
<dl>
<dt>Returns:</dt>
<dd>
-millisecond count converted to nanoseconds
+hour count converted to nanoseconds
+</dd>
+
+</dl>
+</blockquote>
+
+<pre><code>operator microseconds() const
+</code></pre>
+
+<blockquote>
+<dl>
+<dt>Returns:</dt>
+<dd>
+hour count converted to microseconds
+</dd>
+
+</dl>
+</blockquote>
+
+<pre><code>operator milliseconds() const
+</code></pre>
+
+<blockquote>
+<dl>
+<dt>Returns:</dt>
+<dd>
+hour count converted to milliseconds
</dd>
</dl>
</blockquote>
<pre><code>
-operator microseconds() const
+operator seconds() const
</code></pre>
<blockquote>
<dl>
<dt>Returns:</dt>
<dd>
-millisecond count converted to microseconds
+hour count converted to seconds
+</dd>
+
+</dl>
+</blockquote>
+
+<pre><code>
+operator minutes() const
+</code></pre>
+
+<blockquote>
+<dl>
+<dt>Returns:</dt>
+<dd>
+hour count converted to seconds.
</dd>
</dl>
@@ -4258,7 +4366,7 @@
<dl>
<dt>Returns:</dt>
<dd>
-1000
+0
</dd>
</dl>
@@ -4272,7 +4380,7 @@
<dl>
<dt>Returns:</dt>
<dd>
-0
+3600
</dd>
</dl>
@@ -4286,113 +4394,153 @@
<dl>
<dt>Returns:</dt>
<dd>
-true
+false
</dd>
</dl>
</blockquote>
-<h3><a name="time.seconds">32.7 Class seconds [time.seconds]</a></h3>
+<h3><a name="time.system">31.8 Class system_time [time.system]</a></h3>
<p>
-Objects of class <code>seconds</code>
-can be used to represent a count of seconds. Class <code>seconds</code> shall be
-a duration type ([time.duration.requirements]). For the sake of exposition, the
-semantics of member functions are not described if they have the same apparent
-semantics as those specified for duration types.</p>
+The class <code>system_time</code> provides a time point
+that represents the current
+Coordinated Universal Time, known as UTC, time.
+<code>system_time</code>
+shall provide an epoch time of 1970-01-01 00:00:00.000000000
+and a maximum time value of at least epoch time + 292 years.
+</p>
+
+<p>
+<b>[Crowl:
+I hope I'm not getting too pedantic here,
+but I'd recommend encuraging a "system time" based on UTC
+rather than on defining it so.
+The reason is that embedded systems
+need to function independent of the global time system
+when lives are at stake.
+I don't want the flight control software dependent on UTC.
+]</b>
+</p>
<blockquote>
<pre><code>
-class seconds
+class system_time
{
public:
- seconds(long long s=0);
- seconds(const seconds& rhs);
- ~seconds();
- // <em>conversions</em>
- operator nanoseconds() const
- operator microseconds() const
- operator milliseconds() const
+ system_time();
+ system_time(time_t, nanoseconds ns);
+ ~system_time();
- // <em>traits information</em>
+ time_t seconds_since_epoch() const;
+ nanoseconds nanoseconds_since_epoch() const;
+
+ // <em>traits</em>
+ typedef 'implementation defined' tick_type;
static tick_type ticks_per_second();
static tick_type seconds_per_tick();
static bool is_subsecond();
- typedef <var><strong>implementation-defined</strong></var> tick_type;
- // <em>+ common functions</em>
+ // <em>comparison functions</em>
+ bool operator==(const system_time& rhs) const;
+ bool operator!=(const system_time& rhs) const;
+ bool operator>(const system_time& rhs) const;
+ bool operator>=(const system_time& rhs) const;
+ bool operator<(const system_time& rhs) const;
+ bool operator<=(const system_time& rhs) const;
+
+ // <em>arithmetic functions</em>
+ nanoseconds operator-(const system_time& rhs) const
+
+ template<typename Duration>
+ system_time operator+(const Duration& td) const;
+
+ template<typename Duration>
+ system_time& operator+=(const Duration& td);
+
+ template<typename Duration>
+ system_time operator-(const Duration& td) const;
+
+ template<typename Duration>
+ system_time& operator-=(const Duration& td)
};
</code></pre>
</blockquote>
-<pre><code>
-seconds(long long=0);
-</code></pre>
-
-<blockquote>
-<dl>
-<dt>Effects:</dt>
-<dd>
-Construct<var>s</var> an object with a count of seconds - default is
-zero.
-</dd>
+<p>
+[<i>Note:</i>
+292 years represents the number of nanoseconds
+that can be represented in a signed 64 bit integer.
+—<i>end note</i>]
+</p>
-</dl>
-</blockquote>
+<p>Unless otherwise specified, no
+<code>system_time</code> member functions shall throw
+exceptions.</p>
<pre><code>
-seconds(const seconds& rhs);
+system_time();
</code></pre>
<blockquote>
<dl>
<dt>Effects:</dt>
<dd>
-Copy construction.
+Constructs a system_time
+object representing the epoch time point 1970-01-01 00:00:00.000000000
</dd>
</dl>
</blockquote>
<pre><code>
-operator nanoseconds() const
+system_time(time_t secs, nanoseconds ns);
</code></pre>
<blockquote>
<dl>
-<dt>Returns:</dt>
+<dt>Effects:</dt>
<dd>
-second count converted to nanoseconds
+Construct<var>s</var> a utc
+time object representing the time point
+that is secs + 1,000,000,000*ns after the epoch.
+</dd>
+
+<dt>Remarks:</dt>
+<dd>
+If the total nanoseconds > 1 second the seconds are
+incremented appropriately.
</dd>
</dl>
</blockquote>
<pre><code>
-operator microseconds() const
+time_t seconds_since_epoch() const;
</code></pre>
<blockquote>
<dl>
<dt>Returns:</dt>
<dd>
-second count converted to microseconds
+The count of seconds since 1970-01-01 00:00:00.
</dd>
</dl>
</blockquote>
<pre><code>
-operator milliseconds() const
+nanoseconds nanoseconds_since_epoch() const;
</code></pre>
<blockquote>
<dl>
<dt>Returns:</dt>
<dd>
-second count converted to milliseconds
+The count of nanoseconds
+since 1970-01-01 00:00:00.
</dd>
</dl>
@@ -4406,7 +4554,7 @@
<dl>
<dt>Returns:</dt>
<dd>
-1
+1000000000
</dd>
</dl>
@@ -4420,7 +4568,7 @@
<dl>
<dt>Returns:</dt>
<dd>
-1
+0
</dd>
</dl>
@@ -4434,350 +4582,334 @@
<dl>
<dt>Returns:</dt>
<dd>
-false
+true.
</dd>
</dl>
</blockquote>
-<h3><a name="time.minutes">32.8 Class minutes [time.minutes]</a></h3>
-
-<p>
-Objects of class <code>minutes</code>
-can be used to represent a count of minutes. Class <code>minutes</code> shall be
-a duration type ([time.duration.requirements]). For the sake of exposition, the
-semantics of member functions are not described if they have the same apparent
-semantics as those specified for duration types.</p>
-
-<blockquote>
-<pre><code>
-class minutes
-{
-public:
- minutes(long long s=0);
- minutes(const minutes& rhs);
- ~minutes();
-
- // <em>conversions</em>
- operator nanoseconds() const
- operator microseconds() const
- operator milliseconds() const
- operator seconds() const
-
- // <em>traits information</em>
- static tick_type ticks_per_second();
- static tick_type seconds_per_tick();
- static bool is_subsecond();
- typedef <var><strong>implementation-defined</strong></var> tick_type;
-
- // <em>+ common functions</em>
-
-};
-</code></pre>
-</blockquote>
-
<pre><code>
-minutes(long long=0);
+bool operator==(const system_time& rhs) const;
</code></pre>
<blockquote>
<dl>
-<dt>Effects:</dt>
+<dt>Returns:</dt>
<dd>
-Construct<var>s</var> an object with a count of minutes - default is
-zero.
+True if
+the time
+represented by <code>*this</code> is equal to the time represented by <var>rhs</var>.
</dd>
</dl>
</blockquote>
<pre><code>
-minutes(const minutes& rhs);
+bool operator!=(const system_time& rhs) const;
</code></pre>
<blockquote>
<dl>
-<dt>Effects:</dt>
+<dt>Returns:</dt>
<dd>
-Copy construction.
+True if the time represented by <code>*this</code> is not equal to the time represented
+by <var>rhs</var>.
</dd>
</dl>
</blockquote>
<pre><code>
-operator nanoseconds() const
+bool operator>(const system_time& rhs) const;
</code></pre>
<blockquote>
<dl>
<dt>Returns:</dt>
<dd>
-minute count converted to nanoseconds
+True if time represented by
+<code>*this</code> is greater than the time represented by <var>rhs</var>.
</dd>
</dl>
</blockquote>
<pre><code>
-operator microseconds() const
+bool operator>=(const system_time& rhs) const;
</code></pre>
<blockquote>
<dl>
<dt>Returns:</dt>
<dd>
-minute count converted to microseconds
+True if time represented
+by <code>*this</code> is greater or equal than the time represented by <var>rhs</var>.
</dd>
</dl>
</blockquote>
<pre><code>
-operator milliseconds() const
+bool operator<(const system_time& rhs) const;
</code></pre>
<blockquote>
<dl>
<dt>Returns:</dt>
<dd>
-minute count converted to milliseconds
+True if time represented by <code>*this</code>
+is less than the time represented by <var>rhs</var>.
</dd>
</dl>
</blockquote>
<pre><code>
-operator seconds() const
+bool operator<=(const system_time& rhs) const;
</code></pre>
<blockquote>
<dl>
<dt>Returns:</dt>
<dd>
-minute count converted to seconds
+True if time represented by <code>*this</code>
+is less or equal than the time represented by <var>rhs</var>.
</dd>
</dl>
</blockquote>
<pre><code>
-static tick_type ticks_per_second();
+nanoseconds operator-(const system_time& <var>rhs</var>) const
</code></pre>
<blockquote>
<dl>
<dt>Returns:</dt>
<dd>
-0
+The difference in nanoseconds between
+the time represented by <code>*this</code> and
+the time represented by <code><var>rhs</var></code>.
+</dd>
+
+<dt>Remarks:</dt>
+<dd>
+If rhs is greater the result will be a negative nanosecond.
+count.
</dd>
</dl>
</blockquote>
<pre><code>
-static tick_type seconds_per_tick();
+template<typename Duration>
+system_time operator+(const Duration& td) const;
</code></pre>
<blockquote>
<dl>
<dt>Returns:</dt>
<dd>
-60
+The duration converted to nanosecond resolution
+and added to the time represented by <code>*this</code>.
</dd>
</dl>
</blockquote>
<pre><code>
-static bool is_subsecond();
+template<typename Duration>
+system_time& operator+=(const Duration& td);
</code></pre>
<blockquote>
<dl>
-<dt>Returns:</dt>
+<dt>Effects:</dt>
<dd>
-false
+Convert the duration to nanosecond resolution
+and add it to the time represented by <code>*this</code>.
</dd>
-</dl>
-</blockquote>
-
-<h3><a name="time.hours">31.9 Class hours [time.hours]</a></h3>
-
-<p>
-Objects of class <code>hours</code>
-can be used to represent a count of hours. Class <code>hours</code> shall be a
-duration type ([time.duration.requirements]). For the sake of exposition, the
-semantics of member functions are not described if they have the same apparent
-semantics as those specified for duration types.</p>
-
-<blockquote>
-<pre><code>
-class hours
-{
-public:
- hours(long long s=0);
- hours(const hours& rhs);
- ~hours();
-
- // <em>conversions</em>
- operator nanoseconds() const
- operator microseconds() const
- operator milliseconds() const
- operator seconds() const
- operator minutes() const
-
- // <em>traits information</em>
- static tick_type ticks_per_second();
- static tick_type seconds_per_tick();
- static bool is_subsecond();
- typedef <var><strong>implementation-defined</strong></var> tick_type;
-
- // <em>+ common functions</em>
+<dt>Returns:</dt>
+<dd>
+<code>*this</code></dd>
-};
-</code></pre>
+</dl>
</blockquote>
<pre><code>
-hours(long long=0);
+template<typename Duration>
+system_time operator-(const Duration& td) const;
</code></pre>
<blockquote>
<dl>
-<dt>Effects:</dt>
+<dt>Returns:</dt>
<dd>
-Construct<var>s</var> an object with a count of hours - default is zero.
+The duration converted to nanosecond resolution
+and subtracted from the time represented by <code>*this</code>.
</dd>
</dl>
</blockquote>
<pre><code>
-hours(const hours& rhs);
+template<typename Duration>
+system_time& operator-=(const Duration& td)
</code></pre>
<blockquote>
<dl>
<dt>Effects:</dt>
<dd>
-Copy construction.
+Convert the duration to nanosecond resolution
+and subtract it from the time represented by <code>*this</code>.
</dd>
+<dt>Returns:</dt>
+<dd>
+<code>*this</code></dd>
+
</dl>
</blockquote>
-<pre><code>
-operator nanoseconds() const
-</code></pre>
+
+<h3><a name="time.nonmembers">32.9 Non-member functions[time.nonmembers]</a></h3>
+
+<pre><code>system_time get_system_time();</code></pre>
<blockquote>
<dl>
+
<dt>Returns:</dt>
<dd>
-hour count converted to nanoseconds
-</dd>
+The system time as provided by the operating system.<i> [Note:</i> Provides access to the system clock at a
+resolution up to nanoseconds.
+The actual resolution may vary from platform to platform.<i> --end note]</i></dd>
+
+<dt>Throws:</dt>
+<dd>
+<code>system_error</code>
+([syserr.syserr]) if unable to return the specified value. The conditions for
+which this might occur are implementation defined.</dd>
</dl>
</blockquote>
-<pre><code>operator microseconds() const
-</code></pre>
+<pre><code>template <class LhsDuration, class RhsDuration>
+ bool operator==(const LhsDuration& lhs, const RhsDuration& rhs);</code></pre>
<blockquote>
<dl>
+
<dt>Returns:</dt>
<dd>
-hour count converted to microseconds
-</dd>
+If the resolution of <code>LhsDuration</code> is the same as the resolution of
+<code>RhsDuration</code>, <code>lhs.get_count()==rhs.get_count()</code>.
+Otherwise, if the resolution of <code>LhsDuration</code> is finer than the
+resolution of <code>RhsDuration</code>, <code>lhs.get_count()==x, where x is
+rhs.get_count() </code>converted to the resolution of <code>LhsDuration</code>.
+Otherwise, <code>x==rhs.get_count(), where x is lhs.get_count() </code>
+converted to the resolution of <code>RhsDuration</code>.</dd>
</dl>
</blockquote>
-
-<pre><code>operator milliseconds() const
-</code></pre>
-
+<pre><code>template <class LhsDuration, class RhsDuration>
+ bool operator!=(const LhsDuration& lhs, const RhsDuration& rhs);</code></pre>
<blockquote>
<dl>
+
<dt>Returns:</dt>
<dd>
-hour count converted to milliseconds
-</dd>
+<code>!(lhs==rhs)</code>.</dd>
</dl>
</blockquote>
-
-<pre><code>
-operator seconds() const
-</code></pre>
-
+<pre><code>template <class LhsDuration, class RhsDuration>
+ bool operator< (const LhsDuration& lhs, const RhsDuration& rhs);</code></pre>
<blockquote>
<dl>
+
<dt>Returns:</dt>
<dd>
-hour count converted to seconds
-</dd>
+If the resolution of <code>LhsDuration</code> is the same as the resolution of
+<code>RhsDuration</code>, <code>lhs.get_count()<rhs.get_count()</code>.
+Otherwise, if the resolution of <code>LhsDuration</code> is finer than the
+resolution of <code>RhsDuration</code>, <code>lhs.get_count()<x, where x is
+rhs.get_count() </code>converted to the resolution of <code>LhsDuration</code>.
+Otherwise, <code>x<rhs.get_count(), where x is lhs.get_count() </code>
+converted to the resolution of <code>RhsDuration</code>.</dd>
</dl>
</blockquote>
-
-<pre><code>
-operator minutes() const
-</code></pre>
-
+<pre><code>template <class LhsDuration, class RhsDuration>
+ bool operator<=(const LhsDuration& lhs, const RhsDuration& rhs);</code></pre>
<blockquote>
<dl>
+
<dt>Returns:</dt>
<dd>
-hour count converted to seconds.
-</dd>
+<code>!(rhs<lhs)</code>.</dd>
</dl>
</blockquote>
-
-<pre><code>
-static tick_type ticks_per_second();
-</code></pre>
-
+<pre><code>template <class LhsDuration, class RhsDuration>
+ bool operator> (const LhsDuration& lhs, const RhsDuration& rhs);</code></pre>
<blockquote>
<dl>
+
<dt>Returns:</dt>
<dd>
-0
-</dd>
+<code>rhs<lhs)</code>.</dd>
</dl>
</blockquote>
-
-<pre><code>
-static tick_type seconds_per_tick();
-</code></pre>
-
+<pre><code>template <class LhsDuration, class RhsDuration>
+ bool operator>=(const LhsDuration& lhs, const RhsDuration& rhs);</code></pre>
<blockquote>
<dl>
+
<dt>Returns:</dt>
<dd>
-3600
-</dd>
+<code>!(lhs<rhs)</code>.</dd>
</dl>
</blockquote>
+<pre><code>template <class LhsDuration, class RhsDuration>
+ <i>FRDuration</i> operator+(const LhsDuration& lhs, const RhsDuration& rhs)</code></pre>
+<blockquote>
+<dl>
-<pre><code>
-static bool is_subsecond();
-</code></pre>
+<dt>Returns:</dt>
+<dd>
+If the resolution of <code>LhsDuration</code> is the same as the resolution of
+<code>RhsDuration</code>, <code>LhsDuration(lhs.get_count()+rhs.get_count())</code>.
+Otherwise, if the resolution of <code>LhsDuration</code> is finer than the
+resolution of <code>RhsDuration</code>, <code>LhsDuration(lhs.get_count()+x),
+where x is rhs.get_count() </code>converted to the resolution of <code>
+LhsDuration</code>. Otherwise, <code>RhsDuration(x+rhs.get_count()), where
+x is lhs.get_count() </code>converted to the resolution of <code>RhsDuration</code>.</dd>
+</dl>
+</blockquote>
+<pre><code>template <class LhsDuration, class RhsDuration>
+ <i>FRDuration</i> operator-(const LhsDuration& lhs, const RhsDuration& rhs)</code></pre>
<blockquote>
<dl>
+
<dt>Returns:</dt>
<dd>
-false
-</dd>
+If the resolution of <code>LhsDuration</code> is the same as the resolution of
+<code>RhsDuration</code>, <code>LhsDuration(lhs.get_count()-rhs.get_count())</code>.
+Otherwise, if the resolution of <code>LhsDuration</code> is finer than the
+resolution of <code>RhsDuration</code>, <code>LhsDuration(lhs.get_count()-x),
+where x is rhs.get_count() </code>converted to the resolution of <code>
+LhsDuration</code>. Otherwise, <code>RhsDuration(x-rhs.get_count()), where
+x is lhs.get_count() </code>converted to the resolution of <code>RhsDuration</code>.</dd>
</dl>
+ <p> </p>
</blockquote>
-
<h2><a name="References">References</a></h2>
<ul>
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk