mirror of
https://github.com/boostorg/date_time.git
synced 2026-02-24 16:02:26 +00:00
updated documentation
[SVN r15046]
This commit is contained in:
40
doc/time__math_8cpp-example.html
Normal file
40
doc/time__math_8cpp-example.html
Normal file
@@ -0,0 +1,40 @@
|
||||
<!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>Example Documentation</title>
|
||||
<link href="doxygen.css" rel="stylesheet" type="text/css">
|
||||
</head><body bgcolor="#ffffff">
|
||||
<!-- Generated by Doxygen 1.2.10 -->
|
||||
<hr><h1>time_math.cpp</h1> Various types of calculations with times and time durations.
|
||||
<p>
|
||||
<div class="fragment"><pre><font class="comment">//Some simple examples of constructing and calculating with times</font>
|
||||
<font class="comment">//Output:</font>
|
||||
<font class="comment">//2002-Feb-01 00:00:00 - 2002-Feb-01 05:04:02.001000000 = -5:04:02.001000000</font>
|
||||
|
||||
<font class="preprocessor">#include "boost/gdtl/posix_time/posix_time.hpp"</font>
|
||||
<font class="preprocessor">#include <iostream></font>
|
||||
|
||||
<font class="keywordtype">int</font>
|
||||
main()<font class="keyword"> </font>
|
||||
<font class="keyword"></font>{
|
||||
<font class="keyword">using</font> <font class="keyword">namespace </font>boost::posix_time;
|
||||
<font class="keyword">using</font> <font class="keyword">namespace </font>boost::gregorian;
|
||||
|
||||
date d(2002,Feb,1); <font class="comment">//an arbitrary date</font>
|
||||
<font class="comment">//construct a time by adding up some durations durations</font>
|
||||
ptime t1(d, hours(5)+minutes(4)+seconds(2)+millisec(1));
|
||||
<font class="comment">//construct a new time by subtracting some times</font>
|
||||
ptime t2 = t1 - hours(5)- minutes(4)- seconds(2)- millisec(1);
|
||||
<font class="comment">//construct a duration by taking the difference between times</font>
|
||||
time_duration td = t2 - t1;
|
||||
|
||||
std::cout << to_simple_string(t2) << <font class="stringliteral">" - "</font>
|
||||
<< to_simple_string(t1) << <font class="stringliteral">" = "</font>
|
||||
<< to_simple_string(td) << std::endl;
|
||||
|
||||
<font class="keywordflow">return</font> 0;
|
||||
}
|
||||
|
||||
</pre></div><hr><address><small>
|
||||
Generated Wed Mar 13 13:38:03 2002 by <a href="http://www.doxygen.org">Doxygen</a> for <a href="http://www.crystalclearsoftware.com">CrystalClear Software</a> © 2000-2002</small></address>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user