|
Boost-Commit : |
From: hinnant_at_[hidden]
Date: 2007-12-07 13:59:29
Author: hinnant
Date: 2007-12-07 13:59:29 EST (Fri, 07 Dec 2007)
New Revision: 41829
URL: http://svn.boost.org/trac/boost/changeset/41829
Log:
merged date_time branch
Text files modified:
sandbox/committee/LWG/ref_impl/hdate_time | 4
sandbox/committee/LWG/thread_library.html | 2218 ++++++++++++---------------------------
2 files changed, 692 insertions(+), 1530 deletions(-)
Modified: sandbox/committee/LWG/ref_impl/hdate_time
==============================================================================
--- sandbox/committee/LWG/ref_impl/hdate_time (original)
+++ sandbox/committee/LWG/ref_impl/hdate_time 2007-12-07 13:59:29 EST (Fri, 07 Dec 2007)
@@ -238,7 +238,7 @@
typedef long long tick_type;
system_time();
- system_time(time_t secs, nanoseconds ns);
+ system_time(time_t secs, nanoseconds ns = 0);
time_t seconds_since_epoch() const;
nanoseconds nanoseconds_since_epoch() const;
@@ -1461,7 +1461,7 @@
public:
system_time() : ns_(0) {}
- system_time(time_t secs, nanoseconds ns)
+ system_time(time_t secs, nanoseconds ns = 0)
: ns_(secs * 1000000000LL + ns.count()) {}
// ~system_time() = default;
Modified: sandbox/committee/LWG/thread_library.html
==============================================================================
--- sandbox/committee/LWG/thread_library.html (original)
+++ sandbox/committee/LWG/thread_library.html 2007-12-07 13:59:29 EST (Fri, 07 Dec 2007)
@@ -29,7 +29,7 @@
<h1>Multi-threading Library for Standard C++</h1>
<p>
-ISO/IEC JTC1 SC22 WG21 N???? = 07-???? - 2007-12-04
+ISO/IEC JTC1 SC22 WG21 N???? = 07-???? - 2007-12-07
</p>
<p>
@@ -94,15 +94,16 @@
<br> 30.4.1 Class condition_variable [thread.condvar]
<br> 30.4.2 Class condition_variable_any [thread.condvarany]
<br>Chapter 31 Date Time Library [time]
-<br> 31.1 Class system_time [time.system]
-<br> 31.2 Function get_system_time [time.getsystem]
-<br> 31.3 Common Duration Functions [time.duration]
-<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.1 Duration Requirements [time.duration.requirements]
+<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>
@@ -3450,20 +3451,22 @@
in the time continuum.
A <dfn>time duration</dfn> represents a length of time
unattached to any time point.
-Time points and time durations have a <dfn>resolution</dfn>,
-which is their smallest representable time duration.
+Time points and time durations have a
+<dfn>resolution</dfn> which is their smallest representable time duration.
Time points
have an <dfn>epoch</dfn> or start of a given time scale.
-For time_t the epoch is
-1970-01-01 00:00:00.
-</p>
+<i>[Example: </i>For std::time_t the epoch is
+1970-01-01 00:00:00. <i>--end example]</i></p>
<p>
Throughout this clause, the names of template parameters are used to express
-type requirements.
-<b>[Someone:
-Define Duration, RhsDuration.
-]</b>
+type requirements. Parameter names <code>Duration</code>, <code>LhsDuration</code>
+and <code>RhsDuration</code> express the
+Duration ([<a name="time.duration">[time.duration.requirements]</a>])
+requirements.
+For all non-member functions in this clause which are templated on Duration types,
+the implementation shall constrain these function templates such that they will
+only instantiate for Duration types.
</p>
<p>
@@ -3475,2006 +3478,1165 @@
namespace std {
// <em>duration types</em>
-class hours;
-class minutes;
-class seconds;
-class milliseconds;
-class microseconds;
class nanoseconds;
+class microseconds;
+class milliseconds;
+class seconds;
+class minutes;
+class hours;
-// <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();
-} // std
-</code></pre>
-</blockquote>
-
-<h3><a name="time.system">31.1 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>
-
-<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>
-
-<p>
-class <code>system_time</code> shall be EqualityComparable, LessThanComparable,
-CopyConstructable, DefaultConstructable, and Assignable.
-</p>
-
-<blockquote>
-<pre><code>
-class system_time
-{
-public:
-
- 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 <var><strong>implementation-defined</strong></var> 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);
+template<typename Duration>
+ system_time operator+(const Duration& td, const system_time& rhs);
- template<typename Duration>
- system_time operator-(const Duration& td) const;
+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)
- template<typename Duration>
- system_time& operator-=(const Duration& td)
+template <class Duration>
+ Duration operator*(Duration lhs, long rhs)
+template <class Duration>
+ Duration operator*(long lhs, Duration rhs)
-};
-</code></pre>
+template <class Duration>
+ Duration operator/(Duration lhs, long rhs)
+} // std</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>Type <i><code>FRDuration</code> </i>is whichever of <code>LhsDuration</code>
+or <code>RhsDuration</code> has the finest resolution. If their
+resolutions are the same, <i><code>FRDuration</code> </i>is <code>LhsDuration</code>.</p>
+
+<p>Unless otherwise specified, no function in this clause shall throw
+exceptions. <i>[Note: </i>Such blanket prohibition of exceptions is unusual in
+the standard library, but without the prohibition time-related code becomes
+littered with excessive try-catch blocks. These functions are also unusual in
+that they encompass virtually no cases where errors can be detected and
+reported. <i>--end note.]</i></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
+templates defined in the C++ Standard Library.</p>
+<p>Objects of duration types provide relative time values and comparison and
+arithmetic operations on those values.</p>
+<p>Template definitions in the C++ Standard Library refer to the named Duration
+requirements for duration types whose details are specified below.</p>
+<p>A duration type shall be EqualityComparable, LessThanComparable,
+CopyConstructible, DefaultConstructible, CopyAssignable, Swappable, and
+Destructible. In addition, it must meet the requirements for well-defined
+expressions specified it the following table, where <code>D</code> and <code>E</code>
+are duration types, <code>d</code> denotes a <code>const</code> value of type
+<code>D</code>, <code>e</code> denotes a <code>const</code> value of type <code>
+E</code>, <code>c</code> denotes a <code>long</code> value.
+The resolution of <code>E</code> shall not be finer than the resolution of <code>D</code>
+(diagnostic required).
</p>
+<table style="border-collapse: collapse;" border="1" bordercolor="#111111" cellpadding="5" cellspacing="0" width="100%">
+ <tr>
+ <td width="25%"><b><i>expression</i></b></td>
+ <td width="11%"><b><i>return type</i></b></td>
+ <td width="39%"><b><i>return value or other requirement</i></b></td>
+ </tr>
+ <tr>
+ <td valign="top" width="25%"><code>D::tick_type</code></td>
+ <td width="11%"><i><b>implementation-defined</b></i></td>
+ <td width="39%"> </td>
+ </tr>
+ <tr>
+ <td valign="top" width="25%"><code>D::ticks_per_second;</code></td>
+ <td valign="top" width="11%"><code>D::tick_type</code></td>
+ <td valign="top" width="39%">The number of ticks per
+ second, or 0 for types for which the number of ticks per second is less than 1. </td>
+ </tr>
+ <tr>
+ <td valign="top" width="25%"><code>D::seconds_per_tick;</code></td>
+ <td valign="top" width="11%"><code>D::tick_type</code></td>
+ <td valign="top" width="39%">The number of seconds per
+ tick, or 0 for types for which the number of seconds per tick is less than 1. </td>
+ </tr>
+ <tr>
+ <td valign="top" width="25%"><code>D::is_subsecond;</code></td>
+ <td valign="top" width="11%"><code>bool</code></td>
+ <td valign="top" width="39%"><code>seconds_per_tick == 0</code>. </td>
+ </tr>
+ <tr>
+ <td valign="top" width="25%"><code>d.count();</code></td>
+ <td valign="top" width="11%"><code>D::tick_type</code></td>
+ <td valign="top" width="39%">The most recent value established by a
+ non-const function's <i>Postcondition</i>.</td>
+ </tr>
+ <tr>
+ <td valign="top" width="25%"><code>-d;</code></td>
+ <td valign="top" width="11%"><code>D</code></td>
+ <td valign="top" width="39%"><code>D(-d.tick_count())</code></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="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>
+ </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="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>
+ </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="39%"><i>Postcondition:</i> <code>d.tick_count() ==
+ d.tick_count()</code><sub>at-entry</sub><code>/c</code></td>
+ </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="39%"><i>Postcondition:</i> <code>d.tick_count()
+ == d.tick_count()</code><sub>at-entry</sub><code>*c</code></td>
+ </tr>
+</table>
-<pre><code>
-system_time();
-</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
-</dd>
-
-<dt>Throws:</dt>
-<dd>
-Nothing.
-</dd>
-</dl>
-</blockquote>
-
-<pre><code>
-system_time(time_t secs, nanoseconds ns);
-</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.
-</dd>
-
-<dt>Throws:</dt>
-<dd>
-Nothing.
-</dd>
-</dl>
-</blockquote>
-
-<pre><code>
-time_t seconds_since_epoch() const;
-</code></pre>
-
-<blockquote>
-<dl>
-<dt>Returns:</dt>
-<dd>
-The count of seconds since the epoch time.
-</dd>
-
-<dt>Throws:</dt>
-<dd>
-Nothing.
-</dd>
-</dl>
-</blockquote>
-
-<pre><code>
-nanoseconds nanoseconds_since_epoch() const;
-</code></pre>
-
-<blockquote>
-<dl>
-<dt>Returns:</dt>
-<dd>
-The count of nanoseconds
-since the epoch time.
-</dd>
-
-<dt>Throws:</dt>
-<dd>
-Nothing.
-</dd>
-</dl>
-</blockquote>
-
-<pre><code>
-static tick_type ticks_per_second();
-</code></pre>
-
-<blockquote>
-<dl>
-<dt>Returns:</dt>
-<dd>
-1000000000
-</dd>
-
-<dt>Throws:</dt>
-<dd>
-Nothing.
-</dd>
-</dl>
-</blockquote>
-
-<pre><code>
-static tick_type seconds_per_tick();
-</code></pre>
-
-<blockquote>
-<dl>
-<dt>Returns:</dt>
-<dd>
-0
-</dd>
-
-<dt>Remarks:</dt>
-<dd>
-Since this is a subsecond type it returns 0 for seconds_per_tick.
-</dd>
-
-<dt>Throws:</dt>
-<dd>
-Nothing.
-</dd>
-</dl>
-</blockquote>
-
-<pre><code>
-static bool is_subsecond();
-</code></pre>
-
-<blockquote>
-<dl>
-<dt>Returns:</dt>
-<dd>
-true.
-</dd>
-
-<dt>Throws:</dt>
-<dd>
-Nothing.
-</dd>
-</dl>
-</blockquote>
-
-<pre><code>
-bool operator==(const system_time& rhs) const;
-</code></pre>
-
-<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>
-
-<dt>Throws:</dt>
-<dd>
-Nothing.
-</dd>
-</dl>
-</blockquote>
-
-<pre><code>
-bool operator!=(const system_time& rhs) const;
-</code></pre>
-
-<blockquote>
-<dl>
-<dt>Returns:</dt>
-<dd>
-True if the time represented by <code>*this</code> is not equal to the time represented
-by <var>rhs</var>.
-</dd>
-<dt>Throws:</dt>
-<dd>
-Nothing.
-</dd>
-</dl>
-</blockquote>
+<h3><a name="time.nanoseconds">32.2 Class nanoseconds [time.nanoseconds]</a></h3>
-<pre><code>
-bool operator>(const system_time& rhs) const;
-</code></pre>
+<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 specified for duration types.</p>
<blockquote>
-<dl>
-<dt>Returns:</dt>
-<dd>
-True if time represented by
-<code>*this</code> is greater than the time represented by <var>rhs</var>.
-</dd>
-
-<dt>Throws:</dt>
-<dd>
-Nothing.
-</dd>
-</dl>
-</blockquote>
-
<pre><code>
-bool operator>=(const system_time& rhs) 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>.
-</dd>
-
-<dt>Throws:</dt>
-<dd>
-Nothing.
-</dd>
-</dl>
-</blockquote>
+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;
+
+ // <i>construct/copy/destroy functions</i>
+ nanoseconds(long long ns=0);
+ nanoseconds(nanoseconds&&);
+ nanoseconds& operator=(nanoseconds&&);
-<pre><code>
-bool operator<(const system_time& rhs) const;
-</code></pre>
+ // <em>observer functions</em>
+ tick_type count() const;
-<blockquote>
-<dl>
-<dt>Returns:</dt>
-<dd>
-True if time represented by <code>*this</code>
-is less than the time represented by <var>rhs</var>.
-</dd>
-
-<dt>Throws:</dt>
-<dd>
-Nothing.
-</dd>
-</dl>
-</blockquote>
-
-<pre><code>
-bool operator<=(const system_time& rhs) const;
-</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>.
-</dd>
-
-<dt>Throws:</dt>
-<dd>
-Nothing.
-</dd>
-</dl>
-</blockquote>
-
-<pre><code>
-nanoseconds operator-(const system_time& <var>rhs</var>) const
-</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.
-</dd>
-
-<dt>Throws:</dt>
-<dd>
-Nothing.
-</dd>
-</dl>
-</blockquote>
-
-<pre><code>
-template<typename Duration>
-system_time operator+(const Duration& td) const;
-</code></pre>
-
-<blockquote>
-<dl>
-<dt>Returns:</dt>
-<dd>
-The duration converted to nanosecond resolution
-and added to the time represented by <code>*this</code>.
-</dd>
-
-<dt>Throws:</dt>
-<dd>
-Nothing.
-</dd>
-</dl>
-</blockquote>
-
-<pre><code>
-template<typename Duration>
-system_time& operator+=(const Duration& td);
-</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>.
-</dd>
-
-<dt>Returns:</dt>
-<dd>
-Modified value of this.
-<b>[Crowl: not a reference to this?]</b>
-</dd>
-
-<dt>Throws:</dt>
-<dd>
-Nothing.
-</dd>
-</dl>
-</blockquote>
-
-<pre><code>
-template<typename Duration>
-system_time operator-(const Duration& td) 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>.
-</dd>
-
-<dt>Throws:</dt>
-<dd>
-Nothing.
-</dd>
-</dl>
-</blockquote>
-
-<pre><code>
-template<typename Duration>
-system_time& operator-=(const Duration& td)
-</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.
-</dd>
-
-<dt>Throws:</dt>
-<dd>
-Nothing.
-</dd>
-</dl>
-</blockquote>
-
-
-<h3><a name="time.getsystem">31.2 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>
-
-<blockquote>
-<pre><code>
-system_time get_system_time();
-</code></pre>
-</blockquote>
-
-
-<p>
-[<b>Comment:</b>
-Typical personal computer platforms currently achieve microsecond level
-resolution from calls to the clock.
-The
-<a href="http://www.boost.org/libs/date_time/index.html">
-Boost Date-Time Library</a>
-has a class that portably implements the proposed interface,
-but it uses different C-level interfaces depending on the operating
-system.
-—<b>end comment</b>]
-</p>
-
-<h3><a name="time.duration">31.3 Common Duration Functions [time.duration]</a></h3>
-
-<p>
-The following functions are common functions to all durations types.
-These
-functions provide the basis
-for durations to be EqualityComparable, LessThanComparable
-as well arithmetic operations.
-</p>
-
-<p>
-In the following text duration_type refers to the containing duration type.
-</p>
-
-<p>
-All duration types are EqualityComparable, LessThanComparable,
-CopyConstructable, DefaultConstructable, and Assignable for duration
-objects of the same type.
-</p>
-
-<blockquote>
-<pre><code>
-class Duration {
-
- // <em>traits information</em>
- typedef <var><strong>implementation-defined</strong></var> tick_type;
- static tick_type ticks_per_second();
- static tick_type seconds_per_tick();
- static bool is_subsecond();
-
- // <em>comparison operators</em>
- template<typename RhsDuration>
- bool operator< (const RhsDuration&) const;
-
- template<typename RhsDuration>
- bool operator<= (const RhsDuration&) const;
-
- template<typename RhsDuration>
- bool operator> (const RhsDuration&) const;
-
- template<typename RhsDuration>
- bool operator>= (const RhsDuration&) const;
-
- template<typename RhsDuration>
- bool operator== (const RhsDuration&) const;
-
- template<typename RhsDuration>
- bool operator!= (const RhsDuration&) const;
-
-
- // <em>sign inversion</em>
- Duration operator-() const
-
- // <em>arithmetic operations</em>
- template<typename RhsDuration>
- Duration operator- (const RhsDuration& d) const
-
- template<typename RhsDuration>
- Duration operator-=(const RhsDuration& d)
-
- template<typename RhsDuration>
- Duration operator+ (const RhsDuration& d) const
-
- template<typename RhsDuration>
- Duration operator+=(const RhsDuration& d)
-
- Duration operator/ (int divisor) const
- Duration operator/=(int divisor)
- Duration operator* (int rhs) const
- Duration operator*=(int divisor)
-
- tick_type get_count() const
-
-}
-</code></pre>
-</blockquote>
-
-<pre><code>
-static tick_type ticks_per_second();
-</code></pre>
-
-<blockquote>
-<dl>
-<dt>Returns:</dt>
-<dd>
-A constant defined separately for each <tt>Duration</tt> type
-indicating the number of ticks per second
-(or 0 for types that are not <code>is_subsecond</code>).
-</dd>
-
-<dt>Throws:</dt>
-<dd>
-Nothing.
-</dd>
-</dl>
-</blockquote>
-
-<pre><code>
-static tick_type seconds_per_tick();
-</code></pre>
-
-<blockquote>
-<dl>
-<dt>Returns:</dt>
-<dd>
-A constant defined separately for each <tt>Duration</tt> type
-indicating the number of seconds per tick
-(or 0 for types that are <code>is_subsecond</code>).
-</dd>
-
-<dt>Throws:</dt>
-<dd>
-Nothing.
-</dd>
-</dl>
-</blockquote>
-
-<pre><code>
-static bool is_subsecond();
-</code></pre>
-
-<blockquote>
-<dl>
-<dt>Returns:</dt>
-<dd>
-<code>true</code> if the resolution of this Duration is finer than 1 second,
-and otherwise <code>false</code>.
-</dd>
-
-<dt>Throws:</dt>
-<dd>
-Nothing.
-</dd>
-</dl>
-</blockquote>
-
-<pre><code>
-template<typename RhsDuration>
-bool operator==(const RhsDuration& rhs) const;
-</code></pre>
-
-<blockquote>
-<dl>
-<dt>Returns:</dt>
-<dd>
-True if rhs duration is greater.
-</dd>
-
-<dt>Throws:</dt>
-<dd>
-Nothing.
-</dd>
-</dl>
-</blockquote>
-
-<pre><code>
-template<typename RhsDuration>
-bool operator!=(const RhsDuration& rhs) const;
-</code></pre>
-
-<blockquote>
-<dl>
-<dt>Returns:</dt>
-<dd>
-True if rhs is not the same time.
-</dd>
-
-<dt>Throws:</dt>
-<dd>
-Nothing.
-</dd>
-</dl>
-</blockquote>
-
-<pre><code>
-template<typename RhsDuration>
-bool operator>(const RhsDuration& rhs) const;
-</code></pre>
-
-<blockquote>
-<dl>
-<dt>Returns:</dt>
-<dd>
-True if the rhs duration is larger.
-</dd>
-
-<dt>Throws:</dt>
-<dd>
-Nothing.
-</dd>
-</dl>
-</blockquote>
-
-<pre><code>
-template<typename RhsDuration>
-bool operator>=(const RhsDuration& rhs) const;
-</code></pre>
-
-<blockquote>
-<dl>
-<dt>Returns:</dt>
-<dd>
-True if greater or equal than the rhs duration.
-</dd>
-
-<dt>Throws:</dt>
-<dd>
-Nothing.
-</dd>
-</dl>
-</blockquote>
-
-<pre><code>
-template<typename RhsDuration>
-bool operator<(const RhsDuration& rhs) const;
-</code></pre>
-
-<blockquote>
-<dl>
-<dt>Returns:</dt>
-<dd>
-True if less than the rhs duration.
-</dd>
-
-<dt>Throws:</dt>
-<dd>
-Nothing.
-</dd>
-</dl>
-</blockquote>
-
-<pre><code>
-template<typename RhsDuration>
-bool operator<=(const RhsDuration& rhs) const;
-</code></pre>
-
-<blockquote>
-<dl>
-<dt>Returns:</dt>
-<dd>
-True if less or equal to the rhs duration.
-</dd>
-
-<dt>Throws:</dt>
-<dd>
-Nothing.
-</dd>
-</dl>
-</blockquote>
-
-<pre><code>
-// <em>sign inversion</em>
-Duration operator-() const
-</code></pre>
-
-<blockquote>
-<dl>
-<dt>Returns:</dt>
-<dd>
-Negated value of the duration.
-</dd>
-
-<dt>Throws:</dt>
-<dd>
-Nothing.
-</dd>
-</dl>
-</blockquote>
-
-<pre><code>
-// <em>arithmetic operations</em>
-template<typename RhsDuration>
-Duration operator- (const RhsDuration& d) const
-</code></pre>
-
-<blockquote>
-<dl>
-<dt>Returns:</dt>
-<dd>
-A duration value equal to this-rhs_duration.
-</dd>
-
-<dt>Remarks:</dt>
-<dd>
-This will fail to compile
-if the <code>RhsDuration</code> is of finer resolution than <code>*this</code>.
-</dd>
-
-<dt>Throws:</dt>
-<dd>
-Nothing.
-</dd>
-</dl>
-</blockquote>
-
-<pre><code>
-template<typename RhsDuration>
-Duration operator-=(const RhsDuration& <var>d</var>)
-</code></pre>
-
-<blockquote>
-<dl>
-<dt>Effects:</dt>
-<dd>
-Modifies the value to <code>*this-<var>d</var></code>.
-</dd>
-
-<dt>Returns:</dt>
-<dd>
-<p>
-<code>this</code>
-<b>[Crowl: but this statement is inconsistent with the declaration!]</b>
-</p>
-</dd>
-
-<dt>Remarks:</dt>
-<dd>
-This will fail to compile
-if the <code>RhsDuration</code> is of finer resolution
-than <code>*this</code>.
-</dd>
-
-<dt>Throws:</dt>
-<dd>
-Nothing.
-</dd>
-</dl>
-</blockquote>
-
-<pre><code>
-template<typename RhsDuration>
-Duration operator+ (const RhsDuration& d) const
-</code></pre>
-
-<blockquote>
-<dl>
-<dt>Returns:</dt>
-<dd>
-<p>
-Duration equal to this+rhs_duration.
-</p>
-</dd>
-
-<dt>Remarks:</dt>
-<dd>
-This will fail to compile
-if the <code>RhsDuration</code> is of finer resolution
-than <code>*this</code>.
-</dd>
-
-<dt>Throws:</dt>
-<dd>
-Nothing.
-</dd>
-</dl>
-</blockquote>
-
-<pre><code>
-template<typename RhsDuration>
-Duration operator+=(const RhsDuration& d)
-</code></pre>
-
-<blockquote>
-<dl>
-<dt>Effects:</dt>
-<dd>
-Modifies to value equal to this+rhs_duration.
-</dd>
-
-<dt>Returns:</dt>
-<dd>
-<p>
-this
-</p>
-</dd>
-
-<dt>Remarks:</dt>
-<dd>
-This will fail to compile
-if the <code>RhsDuration</code> is of finer resolution
-than <code>*this</code>.
-</dd>
-
-<dt>Throws:</dt>
-<dd>
-Nothing.
-</dd>
-</dl>
-</blockquote>
-
-<pre><code>
-Duration operator/ (int divisor) const
-</code></pre>
-
-<blockquote>
-<dl>
-<dt>Returns:</dt>
-<dd>
-Duration with value equal to this/divisor according to
-integer arithmetic rules.
-</dd>
-
-<dt>Throws:</dt>
-<dd>
-Nothing.
-</dd>
-</dl>
-</blockquote>
-
-<pre><code>
-Duration operator/=(int divisor)
-</code></pre>
-
-<blockquote>
-<dl>
-<dt>Effects:</dt>
-<dd>
-Change value of this by this/divisor according to integer
-arithmetic rules.
-</dd>
-
-<dt>Returns:</dt>
-<dd>
-this
-</dd>
-
-<dt>Throws:</dt>
-<dd>
-Nothing.
-</dd>
-</dl>
-</blockquote>
-
-<pre><code>
-Duration operator* (int rhs) const
-</code></pre>
-
-<blockquote>
-<dl>
-<dt>Returns:</dt>
-<dd>
-Duration with value equal to this*rhs
-</dd>
-
-<dt>Throws:</dt>
-<dd>
-Nothing.
-</dd>
-</dl>
-</blockquote>
-
-<pre><code>
-Duration operator*=(int rhs)
-</code></pre>
-
-<blockquote>
-<dl>
-<dt>Effects:</dt>
-<dd>
-Modifies to value equal to this*rhs.
-</dd>
-
-<dt>Returns:</dt>
-<dd>
-this
-</dd>
-
-<dt>Throws:</dt>
-<dd>
-Nothing.
-</dd>
-</dl>
+<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);
+
+ // <i>operations</i>
+ nanoseconds operator-() const;
+};</code></pre>
</blockquote>
<pre><code>
-tick_type get_count() const
-</code></pre>
+nanoseconds(long long ns=0);</code></pre>
<blockquote>
<dl>
-<dt>Returns:</dt>
+<dt>Effects:</dt>
<dd>
-The count at the resolution of the time duration type.
+Constructs an object of type <code>nanoseconds</code>.
</dd>
-<dt>Throws:</dt>
-<dd>
-Nothing.
-</dd>
+<dt>Postcondition:</dt>
+<dd><code>count() == ns;</code></dd>
</dl>
</blockquote>
-<h3><a name="time.nanoseconds">31.4 Class nanoseconds [time.nanoseconds]</a></h3>
+<h3><a name="time.microseconds">32.3 Class microseconds [time.microseconds]</a></h3>
<p>
-Objects of class <code>nanoseconds</code> can be used to represent a count of nanoseconds.
-</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 specified for duration types.</p>
<blockquote>
<pre><code>
-class nanoseconds
+class microseconds
{
public:
-
- nanoseconds(long long=0);
- nanoseconds(const nanoseconds& rhs);
- ~nanoseconds();
-
// <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;
+ static const tick_type ticks_per_second = 1000000;
+ static const tick_type seconds_per_tick = 0;
+ static const bool is_subsecond = true;
+
+ // <i>construct/copy/destroy functions</i>
+ microseconds(long long us=0);
+ microseconds(microseconds&&);
+ microseconds& operator=(microseconds&&);
- // <em>+ common functions</em>
+ // <em>observer functions</em>
+ tick_type count() const;
-};
-</code></pre>
+<i> // modifier functions</i>
+ template<typename RhsDuration>
+ microseconds& operator-=(const RhsDuration& d);
+ template<typename RhsDuration>
+ microseconds& operator+=(const RhsDuration& d);
+ microseconds& operator*=(long multiplier);
+ microseconds& operator/=(long divisor);
+
+ // <i>operations</i>
+ microseconds operator-() const;
+
+ // <em>conversions</em>
+ operator nanoseconds() const;
+};</code></pre>
</blockquote>
-<pre><code>
-nanoseconds(long long=0);
-</code></pre>
+<pre><code>microseconds(long long us=0);</code></pre>
<blockquote>
<dl>
<dt>Effects:</dt>
<dd>
-Constructs an object with a count of nanoseconds - default
-is zero.
+Constructs an object of type <code>microseconds</code>.
</dd>
-<dt>Throws:</dt>
-<dd>
-Nothing.
-</dd>
+<dt>Postcondition:</dt>
+<dd><code>count() == us;</code></dd>
</dl>
</blockquote>
-<pre><code>
-nanoseconds(const nanoseconds& rhs);
-</code></pre>
+<pre><code>operator nanoseconds() const;</code></pre>
<blockquote>
<dl>
-<dt>Effects:</dt>
+<dt>Returns:</dt>
<dd>
-Copy construction.
+<code>count() * 1000</code>.
</dd>
-<dt>Throws:</dt>
-<dd>
-Nothing.
-</dd>
</dl>
</blockquote>
+ <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 specified for duration types.</p>
+
+<blockquote>
<pre><code>
-static tick_type ticks_per_second();
-</code></pre>
+class milliseconds
+{
+public:
+ // <em>traits information</em>
+ typedef <var><strong>implementation-defined</strong></var> tick_type;
+ static const tick_type ticks_per_second = 1000;
+ static const tick_type seconds_per_tick = 0;
+ static const bool is_subsecond = true;
+
+ // <i>construct/copy/destroy functions</i>
+ milliseconds(long long ms=0);
+ milliseconds(milliseconds&&);
+ milliseconds& operator=(milliseconds&&);
+
+ // <em>observer functions</em>
+ tick_type count() const;
+
+<i> // modifier functions</i>
+ template<typename RhsDuration>
+ milliseconds& operator-=(const RhsDuration& d);
+ template<typename RhsDuration>
+ milliseconds& operator+=(const RhsDuration& d);
+ milliseconds& operator*=(long multiplier);
+ milliseconds& operator/=(long divisor);
+
+ // <i>operations</i>
+ milliseconds operator-() const;
+
+ // <em>conversions</em>
+ operator nanoseconds() const;
+ operator microseconds() const;
+};</code></pre>
+</blockquote>
+
+<pre><code>
+milliseconds(long long ms=0);</code></pre>
<blockquote>
<dl>
-<dt>Returns:</dt>
+<dt>Effects:</dt>
<dd>
-1000000000
+Constructs an object of type <code>milliseconds</code>.
</dd>
-<dt>Throws:</dt>
-<dd>
-Nothing.
-</dd>
+<dt>Postcondition:</dt>
+<dd><code>count() == ms;</code></dd>
</dl>
</blockquote>
-<pre><code>
-static tick_type seconds_per_tick();
-</code></pre>
+<pre><code>operator nanoseconds() const;</code></pre>
<blockquote>
<dl>
<dt>Returns:</dt>
<dd>
-0
+<code>count() * 1000000</code>.
</dd>
-<dt>Throws:</dt>
-<dd>
-Nothing.
-</dd>
</dl>
</blockquote>
-<pre><code>
-static bool is_subsecond();
-</code></pre>
+<pre><code>operator microseconds() const;</code></pre>
<blockquote>
<dl>
<dt>Returns:</dt>
<dd>
-true
+<code>count() * 1000</code>.
</dd>
-<dt>Throws:</dt>
-<dd>
-Nothing.
-</dd>
</dl>
</blockquote>
-<h3><a name="time.microseconds">31.5 Class microseconds [time.microseconds]</a></h3>
+ <h3>
+ <a name="time.seconds">32.5 Class seconds [time.seconds]</a>
+ </h3>
<p>
-Objects of class <code>microseconds</code>
-can be used to represent a count of microseconds.
-</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 specified for duration types.</p>
<blockquote>
<pre><code>
-class microseconds
+class seconds
{
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;
+ static const tick_type ticks_per_second = 1;
+ static const tick_type seconds_per_tick = 1;
+ static const bool is_subsecond = false;
- // <em>+ common functions</em>
-
-};
+ // <i>construct/copy/destroy functions</i>
+ seconds(long long s=0);
+ seconds(seconds&&);
+ seconds& operator=(seconds&&);
-</code></pre>
-</blockquote>
+ // <em>observer functions</em>
+ tick_type count() const;
-<pre><code>
-microseconds(long long=0);
-</code></pre>
+<i> // modifier functions</i>
+ template<typename RhsDuration>
+ seconds& operator-=(const RhsDuration& d);
+ template<typename RhsDuration>
+ seconds& operator+=(const RhsDuration& d);
+ seconds& operator*=(long multiplier);
+ seconds& operator/=(long divisor);
-<blockquote>
-<dl>
-<dt>Effects:</dt>
-<dd>
-Constructs an object with a count of microseconds - default
-is zero.
-</dd>
+ // <i>operations</i>
+ seconds operator-() const;
-<dt>Throws:</dt>
-<dd>
-Nothing.
-</dd>
-</dl>
+ // <em>conversions</em>
+ operator nanoseconds() const;
+ operator microseconds() const;
+ operator milliseconds() const;
+};</code></pre>
</blockquote>
<pre><code>
-microseconds(const microseconds& rhs);
-</code></pre>
+seconds(long long s=0);</code></pre>
<blockquote>
<dl>
<dt>Effects:</dt>
<dd>
-Copy construction.
-</dd>
-
-<dt>Throws:</dt>
-<dd>
-Nothing.
-</dd>
-</dl>
-</blockquote>
-
-<pre><code>
-// <em>conversions</em>
-operator nanoseconds() const
-</code></pre>
-
-<blockquote>
-<dl>
-<dt>Returns:</dt>
-<dd>
-microsecond count converted to nanoseconds
+Constructs an object of type <code>seconds</code>.
</dd>
-<dt>Throws:</dt>
-<dd>
-Nothing.
-</dd>
+<dt>Postcondition:</dt>
+<dd><code>count() == s;</code></dd>
</dl>
</blockquote>
-<pre><code>
-static tick_type ticks_per_second();
-</code></pre>
+<pre><code>operator nanoseconds() const;</code></pre>
<blockquote>
<dl>
<dt>Returns:</dt>
<dd>
-1000000
+<code>count() * 1000000000</code>.
</dd>
-<dt>Throws:</dt>
-<dd>
-Nothing.
-</dd>
</dl>
</blockquote>
-<pre><code>
-static tick_type seconds_per_tick();
-</code></pre>
+<pre><code>operator microseconds() const;</code></pre>
<blockquote>
<dl>
<dt>Returns:</dt>
<dd>
-0
+<code>count() * 1000000</code>.
</dd>
-<dt>Throws:</dt>
-<dd>
-Nothing.
-</dd>
</dl>
</blockquote>
-<pre><code>
-static bool is_subsecond();
-</code></pre>
+<pre><code>operator milliseconds() const;</code></pre>
<blockquote>
<dl>
<dt>Returns:</dt>
<dd>
-true
+<code>count() * 1000</code>.
</dd>
-<dt>Throws:</dt>
-<dd>
-Nothing.
-</dd>
</dl>
</blockquote>
-<h3><a name="time.milliseconds">31.6 Class milliseconds [time.milliseconds]</a></h3>
+ <h3>
+ <a name="time.minutes">32.6 Class minutes [time.minutes]</a>
+ </h3>
<p>
-Objects of class <code>milliseconds</code>
-can be used to represent a count of milliseconds.
-</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 specified for duration types.</p>
<blockquote>
<pre><code>
-class milliseconds
+class minutes
{
public:
- milliseconds(long long=0);
- milliseconds(const milliseconds& rhs);
- ~milliseconds();
-
- // <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;
+ static const tick_type ticks_per_second = 0;
+ static const tick_type seconds_per_tick = 60;
+ static const bool is_subsecond = false;
+
+ // <i>construct/copy/destroy functions</i>
+ minutes(long long m=0);
+ minutes(minutes&&);
+ minutes& operator=(minutes&&);
- // <em>+ common functions</em>
-};
-</code></pre>
-</blockquote>
+ // <em>observer functions</em>
+ tick_type count() const;
-<pre><code>
-milliseconds(long long=0);
-</code></pre>
+<i> // modifier functions</i>
+ template<typename RhsDuration>
+ minutes& operator-=(const RhsDuration& d);
+ template<typename RhsDuration>
+ minutes& operator+=(const RhsDuration& d);
+ minutes& operator*=(long multiplier);
+ minutes& operator/=(long divisor);
-<blockquote>
-<dl>
-<dt>Effects:</dt>
-<dd>
-Constructs an object with a count of milliseconds - default
-is zero.
-</dd>
+ // <i>operations</i>
+ minutes operator-() const;
-<dt>Throws:</dt>
-<dd>
-Nothing.
-</dd>
-</dl>
+ // <em>conversions</em>
+ operator nanoseconds() const;
+ operator microseconds() const;
+ operator milliseconds() const;
+ operator seconds() const;
+};</code></pre>
</blockquote>
<pre><code>
-milliseconds(const milliseconds& rhs);
-</code></pre>
+minutes(long long m=0);</code></pre>
<blockquote>
<dl>
<dt>Effects:</dt>
<dd>
-Copy construction.
-</dd>
-
-<dt>Throws:</dt>
-<dd>
-Nothing.
-</dd>
-</dl>
-</blockquote>
-
-<pre><code>
-operator nanoseconds() const
-</code></pre>
-
-<blockquote>
-<dl>
-<dt>Returns:</dt>
-<dd>
-millisecond count converted to nanoseconds
+Constructs an object of type <code>minutes</code>.
</dd>
-<dt>Throws:</dt>
-<dd>
-Nothing.
-</dd>
+<dt>Postcondition:</dt>
+<dd><code>count() == n;</code></dd>
</dl>
</blockquote>
-<pre><code>
-operator microseconds() const
-</code></pre>
+<pre><code>operator nanoseconds() const;</code></pre>
<blockquote>
<dl>
<dt>Returns:</dt>
<dd>
-millisecond count converted to microseconds
+<code>count() * 60000000000</code>.
</dd>
-<dt>Throws:</dt>
-<dd>
-Nothing.
-</dd>
</dl>
</blockquote>
-<pre><code>
-static tick_type ticks_per_second();
-</code></pre>
+<pre><code>operator microseconds() const;</code></pre>
<blockquote>
<dl>
<dt>Returns:</dt>
<dd>
-1000
+<code>count() * 60000000</code>.
</dd>
-<dt>Throws:</dt>
-<dd>
-Nothing.
-</dd>
</dl>
</blockquote>
-<pre><code>
-static tick_type seconds_per_tick();
-</code></pre>
+<pre><code>operator milliseconds() const;</code></pre>
<blockquote>
<dl>
<dt>Returns:</dt>
<dd>
-0
+<code>count() * 60000</code>.
</dd>
-<dt>Throws:</dt>
-<dd>
-Nothing.
-</dd>
</dl>
</blockquote>
-<pre><code>
-static bool is_subsecond();
-</code></pre>
+<pre><code>operator seconds() const;</code></pre>
<blockquote>
<dl>
<dt>Returns:</dt>
<dd>
-true
+<code>count() * 60</code>.
</dd>
-<dt>Throws:</dt>
-<dd>
-Nothing.
-</dd>
</dl>
</blockquote>
-<h3><a name="time.seconds">31.7 Class seconds [time.seconds]</a></h3>
+ <h3>
+ <a name="time.hours">31.7 Class hours [time.hours]</a>
+ </h3>
<p>
-Objects of class <code>seconds</code>
-can be used to represent a count of seconds.
-</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 specified for duration types.</p>
<blockquote>
<pre><code>
-class seconds
+class hours
{
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;
+ static const tick_type ticks_per_second = 0;
+ static const tick_type seconds_per_tick = 3600;
+ static const bool is_subsecond = false;
+
+ // <i>construct/copy/destroy functions</i>
+ hours(long long h=0);
+ hours(hours&&);
+ hours& operator=(hours&&);
- // <em>+ common functions</em>
-
-};
-</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>
-
-<dt>Throws:</dt>
-<dd>
-Nothing.
-</dd>
-</dl>
-</blockquote>
-
-<pre><code>
-seconds(const seconds& rhs);
-</code></pre>
+ // <em>observer functions</em>
+ tick_type count() const;
-<blockquote>
-<dl>
-<dt>Effects:</dt>
-<dd>
-Copy construction.
-</dd>
+<i> // modifier functions</i>
+ template<typename RhsDuration>
+ hours& operator-=(const RhsDuration& d);
+ template<typename RhsDuration>
+ hours& operator+=(const RhsDuration& d);
+ hours& operator*=(long multiplier);
+ hours& operator/=(long divisor);
-<dt>Throws:</dt>
-<dd>
-Nothing.
-</dd>
-</dl>
+ // <i>operations</i>
+ hours operator-() const;
+
+ // <em>conversions</em>
+ operator nanoseconds() const;
+ operator microseconds() const;
+ operator milliseconds() const;
+ operator seconds() const;
+ operator minutes() const;
+};</code></pre>
</blockquote>
<pre><code>
-operator nanoseconds() const
-</code></pre>
+hours(long long h=0);</code></pre>
<blockquote>
<dl>
-<dt>Returns:</dt>
+<dt>Effects:</dt>
<dd>
-second count converted to nanoseconds
+Constructs an object of type <code>hours</code>.
</dd>
-<dt>Throws:</dt>
-<dd>
-Nothing.
-</dd>
+<dt>Postcondition:</dt>
+<dd><code>count() == h;</code></dd>
</dl>
</blockquote>
-<pre><code>
-operator microseconds() const
-</code></pre>
+<pre><code>operator nanoseconds() const;</code></pre>
<blockquote>
<dl>
<dt>Returns:</dt>
<dd>
-second count converted to microseconds
+<code>count() * 3600000000000</code>.
</dd>
-<dt>Throws:</dt>
-<dd>
-Nothing.
-</dd>
</dl>
</blockquote>
-<pre><code>
-operator milliseconds() const
-</code></pre>
+<pre><code>operator microseconds() const;</code></pre>
<blockquote>
<dl>
<dt>Returns:</dt>
<dd>
-second count converted to milliseconds
+<code>count() * 3600000000</code>.
</dd>
-<dt>Throws:</dt>
-<dd>
-Nothing.
-</dd>
</dl>
</blockquote>
-<pre><code>
-static tick_type ticks_per_second();
-</code></pre>
+<pre><code>operator milliseconds() const;</code></pre>
<blockquote>
<dl>
<dt>Returns:</dt>
<dd>
-1
+<code>count() * 3600000</code>.
</dd>
-<dt>Throws:</dt>
-<dd>
-Nothing.
-</dd>
</dl>
</blockquote>
-<pre><code>
-static tick_type seconds_per_tick();
-</code></pre>
+<pre><code>operator seconds() const;</code></pre>
<blockquote>
<dl>
<dt>Returns:</dt>
<dd>
-1
+<code>count() * 3600</code>.
</dd>
-<dt>Throws:</dt>
-<dd>
-Nothing.
-</dd>
</dl>
</blockquote>
-<pre><code>
-static bool is_subsecond();
-</code></pre>
+<pre><code>operator minutes() const;</code></pre>
<blockquote>
<dl>
<dt>Returns:</dt>
<dd>
-false
+<code>count() * 60</code>.
</dd>
-<dt>Throws:</dt>
-<dd>
-Nothing.
-</dd>
</dl>
</blockquote>
-<h3><a name="time.minutes">31.8 Class minutes [time.minutes]</a></h3>
+ <h3>
+ <a name="time.system">31.8 Class system_time [time.system]</a>
+ </h3>
-<p>
-Objects of class <code>minutes</code>
-can be used to represent a count of minutes.
-</p>
+ <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.
+ [<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>
-<blockquote>
-<pre><code>
-class minutes
+ <blockquote>
+ <pre><code>class system_time
{
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
+ system_time();
+ explicit system_time(time_t, nanoseconds ns=0);
- // <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;
+ time_t seconds_since_epoch() const;
+ nanoseconds nanoseconds_since_epoch() const;
- // <em>+ common functions</em>
+ // <em>traits</em>
+ typedef <b><i>implementation defined</i></b> tick_type;
+ static const tick_type ticks_per_second = 1000000000;
+ static const tick_type seconds_per_tick = 0;
+ static const bool is_subsecond = true;
-};
-</code></pre>
-</blockquote>
+ // <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;
-<pre><code>
-minutes(long long=0);
-</code></pre>
+ // <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>system_time(); </code> </pre>
+
+ <blockquote>
+ <dl>
+ <dt>Effects:</dt>
+ <dd>
+ Constructs a <code>system_time</code>
+ object representing the epoch time point 1970-01-01 00:00:00.000000000
+ </dd>
+
+ </dl>
+ </blockquote>
+
+ <pre><code>system_time(time_t secs, nanoseconds ns=0);</code> </pre>
+
+ <blockquote>
+ <dl>
+ <dt>Effects:</dt>
+ <dd>
+ Construct<var>s</var> a <code>system_time</code>
+ time object representing the time point
+ <i><code>secs</code></i> + 1,000,000,000*<i><code>ns</code></i> after the epoch.
+ </dd>
+
+ <dt>Remarks:</dt>
+ <dd>
+ If the total nanoseconds is greater than 1 second, the seconds are
+ incremented appropriately.
+ </dd>
+
+ </dl>
+ </blockquote>
+
+ <pre><code>time_t seconds_since_epoch() const;</code> </pre>
+
+ <blockquote>
+ <dl>
+ <dt>Returns:</dt>
+ <dd>
+ The seconds since 1970-01-01 00:00:00 represented by the current value
+ of <code>*this</code>.
+ </dd>
+
+ </dl>
+ </blockquote>
+
+ <pre><code>nanoseconds nanoseconds_since_epoch() 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.
+The nanoseconds
+since 1970-01-01 00:00:00 represented by the current value of <code>*this</code>.
</dd>
-<dt>Throws:</dt>
-<dd>
-Nothing.
-</dd>
</dl>
</blockquote>
-<pre><code>
-minutes(const minutes& rhs);
-</code></pre>
+<pre><code>bool operator==(const system_time& rhs) const;</code></pre>
<blockquote>
<dl>
-<dt>Effects:</dt>
+<dt>Returns:</dt>
<dd>
-Copy construction.
+True if
+the time point
+represented by <code>*this</code> is the same as the time point represented by <var>
+<code>rhs</code></var>.
</dd>
-<dt>Throws:</dt>
-<dd>
-Nothing.
-</dd>
</dl>
</blockquote>
-<pre><code>
-operator nanoseconds() const
-</code></pre>
+<pre><code>bool operator!=(const system_time& rhs) const;</code></pre>
<blockquote>
<dl>
<dt>Returns:</dt>
<dd>
-minute count converted to nanoseconds
+True if the time point represented by <code>*this</code> is not the same as the time
+point represented
+by <var><code>rhs</code></var>.
</dd>
-<dt>Throws:</dt>
-<dd>
-Nothing.
-</dd>
</dl>
</blockquote>
-<pre><code>
-operator microseconds() const
-</code></pre>
+<pre><code>bool operator>(const system_time& rhs) const;</code></pre>
<blockquote>
<dl>
<dt>Returns:</dt>
<dd>
-minute count converted to microseconds
+True if the time point represented by
+<code>*this</code> is later than the time point represented by <var><code>rhs</code></var>.
</dd>
-<dt>Throws:</dt>
-<dd>
-Nothing.
-</dd>
</dl>
</blockquote>
-<pre><code>
-operator milliseconds() const
-</code></pre>
+<pre><code>bool operator>=(const system_time& rhs) const;</code></pre>
<blockquote>
<dl>
<dt>Returns:</dt>
<dd>
-minute count converted to milliseconds
+True if the time point represented
+by <code>*this</code> is later or the same as the time point represented by <var>
+<code>rhs</code></var>.
</dd>
-<dt>Throws:</dt>
-<dd>
-Nothing.
-</dd>
</dl>
</blockquote>
-<pre><code>
-operator seconds() const
-</code></pre>
+<pre><code>bool operator<(const system_time& rhs) const;</code></pre>
<blockquote>
<dl>
<dt>Returns:</dt>
<dd>
-minute count converted to seconds
+True if the time point represented by <code>*this</code>
+is earlier than the time point represented by <var><code>rhs</code></var>.
</dd>
-<dt>Throws:</dt>
-<dd>
-Nothing.
-</dd>
</dl>
</blockquote>
-<pre><code>
-static tick_type ticks_per_second();
-</code></pre>
+<pre><code>bool operator<=(const system_time& rhs) const;</code></pre>
<blockquote>
<dl>
<dt>Returns:</dt>
<dd>
-0
+True if the time pointrepresented by <code>*this</code>
+is earlier or the same as the time point represented by <var><code>rhs</code></var>.
</dd>
-<dt>Throws:</dt>
-<dd>
-Nothing.
-</dd>
</dl>
</blockquote>
-<pre><code>
-static tick_type seconds_per_tick();
-</code></pre>
+<pre><code>nanoseconds operator-(const system_time& <var>rhs</var>) const</code></pre>
<blockquote>
<dl>
<dt>Returns:</dt>
<dd>
-60
+The difference in nanoseconds between
+the time point represented by <code>*this</code> and
+the time point represented by <code><var>rhs</var></code>.
</dd>
-<dt>Throws:</dt>
+<dt>Remarks:</dt>
<dd>
-Nothing.
+If <code>*this < rhs</code>, the result will be negative.
</dd>
+
</dl>
</blockquote>
-<pre><code>
-static bool is_subsecond();
-</code></pre>
+<pre><code>template<typename Duration>
+ system_time operator+(const Duration& td) const;</code></pre>
<blockquote>
<dl>
<dt>Returns:</dt>
<dd>
-false
+The sum of <code>td</code> converted to nanosecond resolution
+and the time represented by <code>*this</code>.
</dd>
-<dt>Throws:</dt>
-<dd>
-Nothing.
-</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.
-</p>
+<pre><code>template<typename Duration>
+ system_time& operator+=(const Duration& td);</code></pre>
<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;
+<dl>
+<dt>Effects:</dt>
+<dd>
+Converts <code>td</code> to nanosecond resolution
+and adds it to the time represented by <code>*this</code>.
+</dd>
- // <em>+ common functions</em>
+<dt>Returns:</dt>
+<dd>
+<code>*this</code></dd>
-};
-</code></pre>
+</dl>
</blockquote>
-<pre><code>
-hours(long long=0);
-</code></pre>
+<pre><code>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 difference between the time represented by <code>*this</code> converted to nanosecond resolution
+and <code>td</code>.
</dd>
-<dt>Throws:</dt>
-<dd>
-Nothing.
-</dd>
</dl>
</blockquote>
-<pre><code>
-hours(const hours& rhs);
-</code></pre>
+<pre><code>template<typename Duration>
+ system_time& operator-=(const Duration& td)</code></pre>
<blockquote>
<dl>
<dt>Effects:</dt>
<dd>
-Copy construction.
+Converts <code>td</code> to nanosecond resolution
+and subtracts it from the time represented by <code>*this</code>.
</dd>
-<dt>Throws:</dt>
+<dt>Returns:</dt>
<dd>
-Nothing.
-</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>
-
-<dt>Throws:</dt>
+The system time as provided by the operating system.</dd>
<dd>
-Nothing.
-</dd>
+ </dd>
+<dd>
+<i> [Note:</i> Provides access to the system clock at a
+resolution as fine as nanoseconds.
+The actual resolution may vary.<i> --end note]</i></dd>
+<dt> </dt>
+ <dt>[Note: <span style="font-style: normal">No error reporting is provided.
+ Hosted implementations ([intro.compliance]) presumably utilize system clock
+ API's that never report errors. </span>--end note.] </dt>
+
</dl>
</blockquote>
-<pre><code>
-operator microseconds() const
-</code></pre>
+<pre><code>template<typename Duration>
+ system_time operator+(const Duration& td, const system_time& rhs);</code></pre>
<blockquote>
<dl>
+
<dt>Returns:</dt>
<dd>
-hour count converted to microseconds
-</dd>
+The sum of <code>td</code> converted to nanosecond resolution
+and the time represented by <code>rhs</code>. </dd>
-<dt>Throws:</dt>
-<dd>
-Nothing.
-</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>
+If the resolution of <code>LhsDuration</code> is the same as the resolution of
+<code>RhsDuration</code>, <code>lhs.count()==rhs.count()</code>.
+Otherwise, if the resolution of <code>LhsDuration</code> is finer than the
+resolution of <code>RhsDuration</code>, <code>lhs.count()==x, where x is
+rhs.count() </code>converted to the resolution of <code>LhsDuration</code>.
+Otherwise, <code>x==rhs.count(), where x is lhs.count() </code>
+converted to the resolution of <code>RhsDuration</code>.</dd>
-<dt>Throws:</dt>
+</dl>
+</blockquote>
+<pre><code>template <class LhsDuration, class RhsDuration>
+ bool operator!=(const LhsDuration& lhs, const RhsDuration& rhs);</code></pre>
+<blockquote>
+<dl>
+
+<dt>Returns:</dt>
<dd>
-Nothing.
-</dd>
+<code>!(lhs==rhs)</code>.</dd>
+
</dl>
</blockquote>
+<pre><code>template <class LhsDuration, class RhsDuration>
+ bool operator< (const LhsDuration& lhs, const RhsDuration& rhs);</code></pre>
+<blockquote>
+<dl>
-<pre><code>
-operator seconds() const
-</code></pre>
+<dt>Returns:</dt>
+<dd>
+If the resolution of <code>LhsDuration</code> is the same as the resolution of
+<code>RhsDuration</code>, <code>lhs.count()<rhs.count()</code>.
+Otherwise, if the resolution of <code>LhsDuration</code> is finer than the
+resolution of <code>RhsDuration</code>, <code>lhs.count()<x, where x is
+rhs.count() </code>converted to the resolution of <code>LhsDuration</code>.
+Otherwise, <code>x<rhs.count(), where x is lhs.count() </code>
+converted to the resolution of <code>RhsDuration</code>.</dd>
+</dl>
+</blockquote>
+<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>
-<dt>Throws:</dt>
+</dl>
+</blockquote>
+<pre><code>template <class LhsDuration, class RhsDuration>
+ bool operator> (const LhsDuration& lhs, const RhsDuration& rhs);</code></pre>
+<blockquote>
+<dl>
+
+<dt>Returns:</dt>
<dd>
-Nothing.
-</dd>
+<code>rhs<lhs)</code>.</dd>
+
</dl>
</blockquote>
+<pre><code>template <class LhsDuration, class RhsDuration>
+ bool operator>=(const LhsDuration& lhs, const RhsDuration& rhs);</code></pre>
+<blockquote>
+<dl>
-<pre><code>
-operator minutes() const
-</code></pre>
+<dt>Returns:</dt>
+<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>
+
<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>LhsDuration(lhs.count()+rhs.count())</code>.
+Otherwise, if the resolution of <code>LhsDuration</code> is finer than the
+resolution of <code>RhsDuration</code>, <code>LhsDuration(lhs.count()+x),
+where x is rhs.count() </code>converted to the resolution of <code>
+LhsDuration</code>. Otherwise, <code>RhsDuration(x+rhs.count()), where
+x is lhs.count() </code>converted to the resolution of <code>RhsDuration</code>.</dd>
-<dt>Throws:</dt>
+</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>
-Nothing.
-</dd>
+If the resolution of <code>LhsDuration</code> is the same as the resolution of
+<code>RhsDuration</code>, <code>LhsDuration(lhs.count()-rhs.count())</code>.
+Otherwise, if the resolution of <code>LhsDuration</code> is finer than the
+resolution of <code>RhsDuration</code>, <code>LhsDuration(lhs.count()-x),
+where x is rhs.count() </code>converted to the resolution of <code>
+LhsDuration</code>. Otherwise, <code>RhsDuration(x-rhs.count()), where
+x is lhs.count() </code>converted to the resolution of <code>RhsDuration</code>.</dd>
+
</dl>
</blockquote>
-<pre><code>
-static tick_type ticks_per_second();
+<pre><code>template <class Duration>
+ Duration operator*(Duration lhs, long rhs)
</code></pre>
-
<blockquote>
<dl>
+
<dt>Returns:</dt>
<dd>
-0
+<code>lhs *= rhs</code>.
</dd>
-<dt>Throws:</dt>
-<dd>
-Nothing.
-</dd>
</dl>
</blockquote>
-<pre><code>
-static tick_type seconds_per_tick();
+<pre><code>template <class Duration>
+ Duration operator*(long lhs, Duration rhs)
</code></pre>
-
<blockquote>
<dl>
+
<dt>Returns:</dt>
<dd>
-3600
+<code>rhs *= lhs</code>.
</dd>
-<dt>Throws:</dt>
-<dd>
-Nothing.
-</dd>
</dl>
</blockquote>
-<pre><code>
-static bool is_subsecond();
+<pre><code>template <class Duration>
+ Duration operator/(Duration lhs, long rhs)
</code></pre>
-
<blockquote>
<dl>
+
<dt>Returns:</dt>
<dd>
-false
+<code>lhs /= rhs</code>.
</dd>
-<dt>Throws:</dt>
-<dd>
-Nothing.
-</dd>
</dl>
</blockquote>
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