mirror of
https://github.com/boostorg/date_time.git
synced 2026-02-21 15:02:27 +00:00
101 lines
3.1 KiB
HTML
101 lines
3.1 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 bgcolor="#ffffff">
|
|
<!-- Generated by Doxygen 1.2.10 -->
|
|
|
|
<body>
|
|
<a href="http://www.boost.org">
|
|
<img align="left" src="c++boost.gif" alt="C++ Boost">
|
|
</a>
|
|
|
|
<h1>Date Time Concepts - Calculation</h1>
|
|
<p>
|
|
<p>
|
|
<p>
|
|
<p>
|
|
<a href="index.html">GDTL Index</a> --
|
|
<a href="gregorian.html">Gregorian Index</a> --
|
|
<a href="posix_time.html">Posix Time Index</a>
|
|
<p>
|
|
<font class="bold">Date Time Concepts - Calculation</font>
|
|
<p>
|
|
<a href="DateTimeConcepts-Calculations.html#timepoints">Timepoints</a> --
|
|
<a href="DateTimeConcepts-Calculations.html#durations">Durations</a> --
|
|
<a href="DateTimeConcepts-Calculations.html#intervals">Interval</a> --
|
|
<a href="DateTimeConcepts-Calculations.html#special">Special Cases</a>
|
|
<p>
|
|
|
|
<a name="timepoints"><h2>Timepoints</h2></a>
|
|
|
|
<p>
|
|
This section describes some of basic arithmetic rules that can be performed with GDTL timepoints.
|
|
|
|
<PRE>
|
|
Timepoint + Duration --> Timepoint
|
|
Timepoint - Duration --> Timepoint
|
|
|
|
Duration + Timepoint --> Undefined
|
|
Duration - Timepoint --> Undefined
|
|
|
|
Timepoint + Timepoint --> Undefined
|
|
Timepoint - Timepoint --> Duration
|
|
</PRE>
|
|
<p>
|
|
<a name="durations"><h2>Durations</h2></a>
|
|
<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>
|
|
<a name="intervals"><h2>Intervals</h2></a>
|
|
<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>
|
|
<HR>
|
|
|
|
<p>
|
|
<a name="special"><h2>Special Cases</h2></a>
|
|
|
|
<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: Mon Jul 8 14:26:05 MST 2002
|
|
<!-- hhmts end -->
|
|
by Jeff Garland for <a href="http://www.crystalclearsoftware.com">CrystalClear Software</a> © 2000-2002
|
|
</small></address>
|
|
</body>
|
|
</html>
|
|
|