Files
date_time/doc/local_time_adjust.html
2002-09-05 17:17:25 +00:00

93 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>posix_time::local time adjust 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>Local Time Adjustment</h1>
<p>&nbsp;<p>
<hr>
<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">Local Time Adjustment</font>
<p>
<a href="#header">Header</a> --
<a href="#classoverview">Class Overview</a> --
<p>
<h2><a name="intro">Introduction</a></h2>
<p>
A frequent problem in time representation is the conversion between
various local time systems. In general this is accomplished by
using a reference time system. The reference time system is typically
UTC.
<p>
Since the posix_time system does no internal time adjustment it
can be used to represent both local times and UTC times. However,
the user is currently left to handle conversions and time zone
knowledge explicitly.
<p>
The library offers two different ways to perform UTC to local conversions.
The first is using the time zone settings of the computer. This is
a useful solution for converting a UTC time for a user machine. This
approach depends on the ctime API and will provide incorrect results
if the environment is set incorrectly.
The other approach allows conversion from any zone to UTC and back
independent of the settings of the time zone settings of the
computer. The <a href="exp-local_utc_conversion.html">local utc conversion example</a>
demonstrates both of these techniques.
<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="classoverview">Class Overview</a></h2>
<p>
<table border=1 cellspacing=3 cellpadding=3>
<tr><td><b>Class</b></td>
<td><b>Description</b></td>
<td><b>Example</b></td></tr>
<tr><td>date_time::c_local_adjustor&lt;ptime&gt;::<font class="el">utc_to_local</font>(ptime)</td>
<td>Calculate local machine time from a UTC time based on time zone settings and the C API.</td>
<td>
typedef boost::date_time::c_local_adjustor&lt;ptime&gt; local_adj;<br>
ptime t10(date(2002,Jan,1), hours(7)); <br>
ptime t11 = local_adj::utc_to_local(t10);<br>
</td></tr>
<tr><td>date_time::local_adjustor&lt;ptime, utc_offset, dst_rules&gt;::<font class="el">utc_to_local</font>(ptime)</td>
<td>Calculate local machine time from a UTC time based daylight savings rules and utc offset</td>
<td><a href="exp-local_utc_conversion.html">example</a>
</td></tr>
<tr><td>date_time::local_adjustor&lt;ptime, utc_offset, dst_rules&gt;::<font class="el">local_to_utc</font>(ptime)</td>
<td>Calculate UTC time based on daylight savings rules and utc offset.</td>
<td><a href="exp-local_utc_conversion.html">example</a>
</td></tr>
</table>
<p>
<hr>
<address><small>
<!-- hhmts start -->
Last modified: Thu Sep 5 07:34:28 MST 2002
<!-- hhmts end -->
by <a href="mailto:jeff&#64;crystalclearsoftware.com">Jeff Garland</a> &copy; 2000-2002
</small></address>
</body>
</html>