mirror of
https://github.com/boostorg/date_time.git
synced 2026-01-28 07:02:19 +00:00
112 lines
3.3 KiB
HTML
112 lines
3.3 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
|
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
|
|
<title>gregorian::date_duration Documentation</title>
|
|
<link href="doxygen.css" rel="stylesheet" type="text/css">
|
|
</head>
|
|
|
|
<body>
|
|
<a href="../../../index.htm">
|
|
<img align="left" src="../../../c++boost.gif" alt="C++ Boost">
|
|
</a>
|
|
|
|
<h1>gregorian::date_duration</h1>
|
|
<hr>
|
|
<p>
|
|
<p>
|
|
<a href="index.html">Overall Index</a> --
|
|
<a href="gregorian.html">Gregorian Index</a> --
|
|
<a href="posix_time.html">Posix Time Index</a>
|
|
<p>
|
|
<font class="bold">Date Documentation</font>
|
|
<p>
|
|
<a href="class_date_duration.html#header">Header</a> --
|
|
<a href="class_date_duration.html#construct">Construction</a> --
|
|
<a href="class_date_duration.html#accessors">Accessors</a> --
|
|
<a href="class_date_duration.html#operators">Operators</a>
|
|
<p>
|
|
<h2><a name="intro">Introduction</a></h2>
|
|
|
|
<p>
|
|
The class boost::gregorian::date_duration is a simple day count used for arithmetic with <a href="class_date.html">gregorian::date</a>. A duration can be either positive or negative.
|
|
<p>
|
|
|
|
<p>
|
|
<h2><a name="header">Header</a></h2>
|
|
<pre>
|
|
#include "boost/date_time/gregorian/gregorian.hpp" //include all types plus i/o
|
|
or
|
|
#include "boost/date_time/gregorian/gregorian_types.hpp" //no i/o just types
|
|
</pre>
|
|
<p>
|
|
|
|
<h2><a name="construct">Construction</a></h2>
|
|
|
|
|
|
<p>
|
|
<table border=1 cellspacing=3 cellpadding=3>
|
|
<tr><td><b>Syntax</b></td><td><b>Description</b></td><td><b>Example</b></td></tr>
|
|
<tr><td>date_duration(long)</td>
|
|
<td>Create a duration count.</td>
|
|
<td>date_duration dd(3); //3 days</td></tr>
|
|
</table>
|
|
|
|
<p>
|
|
|
|
<h2><a name="accessors">Accessors</a></h2>
|
|
|
|
|
|
<p>
|
|
<table border=1 cellspacing=3 cellpadding=3>
|
|
<tr><td><b>Syntax</b></td><td><b>Description</b></td><td><b>Example</b></td></tr>
|
|
<tr><td>long <font class="func">days</font>() const</td>
|
|
<td>Get the day count.</td>
|
|
<td>date_duration dd(3); dd.days() --> 3</td></tr>
|
|
<tr><td>bool <font class="func">is_negative</font>() const</td>
|
|
<td>True if number of days is less than zero..</td>
|
|
<td>date_duration dd(-1); dd.is_negative() --> true</td></tr>
|
|
<tr><td>static date_duration <font class="func">unit</font>()</td>
|
|
<td>Return smallest possible unit of duration type.</td>
|
|
<td>date_duration::unit() --> date_duration(1)</td></tr>
|
|
|
|
</table>
|
|
|
|
<p>
|
|
|
|
<h2><a name="operators">Operators</a></h2>
|
|
|
|
|
|
<p>
|
|
<table border=1 cellspacing=3 cellpadding=3>
|
|
<tr><td><b>Syntax</b></td><td><b>Description</b></td><td><b>Example</b></td></tr>
|
|
<tr><td>operator==, operator!=,<br>
|
|
operator>, operator< <br>
|
|
operator>=, operator<=</td>
|
|
<td>A full complement of comparison operators</td>
|
|
<td>dd1 == dd2, etc</td></tr>
|
|
<tr><td>date_duration operator+(date_duration) const</td>
|
|
<td>Add date durations.</td>
|
|
<td>date_duration dd1(3);
|
|
<br>date_duration dd2(5);
|
|
<br>date_duration dd3 = dd1 + dd2;</td></tr>
|
|
<tr><td>date_duration operator-(date_duration) const</td>
|
|
<td>Subtract durations.</td>
|
|
<td>date_duration dd1(3);
|
|
<br>date_duration dd2(5);
|
|
<br>date_duration dd3 = dd1 - dd2;</td></tr>
|
|
|
|
</table>
|
|
|
|
<p>
|
|
|
|
|
|
<hr>
|
|
<address><small>
|
|
<!-- hhmts start -->
|
|
Last modified: Wed Aug 21 15:12:43 MST 2002
|
|
<!-- hhmts end -->
|
|
by <a href="mailto:jeff@crystalclearsoftware.com">Jeff Garland</a> © 2000-2002
|
|
</small></address>
|
|
</body>
|
|
</html>
|
|
|