mirror of
https://github.com/boostorg/date_time.git
synced 2026-01-28 07:02:19 +00:00
95 lines
2.8 KiB
HTML
95 lines
2.8 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>Date-Time Concepts - Calculation</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>Date-Time Concepts - Calculation</h1>
|
|
<p> <p>
|
|
<hr>
|
|
<a href="index.html">Overall Index</a> --
|
|
<a href="gregorian.html">Gregorian Index</a> --
|
|
<a href="posix_time.html">Posix Time Index</a>
|
|
<p>
|
|
<a href="#timepoints">Timepoints</a> --
|
|
<a href="#durations">Durations</a> --
|
|
<a href="#intervals">Interval</a> --
|
|
<a href="#special">Special Cases</a>
|
|
<p>
|
|
|
|
<h2><a name="timepoints">Timepoints</a></h2>
|
|
|
|
<p>
|
|
This section describes some of basic arithmetic rules that can be performed with timepoints.
|
|
|
|
<PRE>
|
|
Timepoint + Duration --> Timepoint
|
|
Timepoint - Duration --> Timepoint
|
|
|
|
Duration + Timepoint --> Undefined
|
|
Duration - Timepoint --> Undefined
|
|
|
|
Timepoint + Timepoint --> Undefined
|
|
Timepoint - Timepoint --> Duration
|
|
</PRE>
|
|
<p>
|
|
<h2><a name="durations">Durations</a></h2>
|
|
<p>
|
|
This section describes standard operations for a time duration.
|
|
<PRE>
|
|
Duration + Duration --> Duration
|
|
Duration - Duration --> Duration
|
|
|
|
Duration * Integer --> Duration
|
|
Integer * Duration --> Duration
|
|
|
|
Duration(∞) * Integer --> Duration(∞)
|
|
Duration(∞)/Integer --> Duration(∞)
|
|
</PRE>
|
|
<p>
|
|
|
|
|
|
<p>
|
|
<h2><a name="intervals">Intervals</a></h2>
|
|
<p>
|
|
Here are the "operations" supported by intervals. They are based on half-open
|
|
range.
|
|
|
|
<PRE>
|
|
//These can be defined by either of 2 Timepoints or a Timepoint and Duration
|
|
Timeinterval intersects Timeinterval --> bool
|
|
Timeinterval intersection Timeinterval --> Timeperiod //results undefined if no intersection
|
|
Timeinterval contains Timepoint --> bool
|
|
Timeinterval contains Timeinterval --> bool
|
|
Timeinterval shift Duration --> shift start and end by duration amount
|
|
|
|
</PRE>
|
|
|
|
<p>
|
|
<h2><a name="special">Special Cases</a></h2>
|
|
|
|
<P>In general special values such as Not A Date Time (NADT) and infinity should follow rules like floating point values. Note that it should be possible to
|
|
configure NADT based systems to throw an exception instead of result in NADT.
|
|
<PRE>
|
|
Timepoint(NADT) + Duration --> Timepoint(NADT)
|
|
Timepoint(∞) + Duration --> Timepoint(∞)
|
|
Timepoint + Duration(∞) --> Timepoint(∞)
|
|
Timepoint - Duration(∞) --> Timepoint(-∞)
|
|
</PRE>
|
|
|
|
<hr>
|
|
<address><small>
|
|
<!-- hhmts start -->
|
|
Last modified: Sat Oct 26 07:12:02 MST 2002
|
|
<!-- hhmts end -->
|
|
by <a href="mailto:jeff@crystalclearsoftware.com">Jeff Garland</a> © 2000-2002
|
|
</small></address>
|
|
</body>
|
|
</html>
|
|
|