<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> <title>Barry: Barry::Sync::TzWrapper Class Reference</title> <link href="tabs.css" rel="stylesheet" type="text/css"/> <link href="doxygen.css" rel="stylesheet" type="text/css"/> </head> <body> <!-- Generated by Doxygen 1.6.2-20100208 --> <div class="navigation" id="top"> <div class="tabs"> <ul> <li><a href="index.html"><span>Main Page</span></a></li> <li><a href="modules.html"><span>Modules</span></a></li> <li><a href="namespaces.html"><span>Namespaces</span></a></li> <li class="current"><a href="annotated.html"><span>Classes</span></a></li> <li><a href="files.html"><span>Files</span></a></li> <li><a href="dirs.html"><span>Directories</span></a></li> </ul> </div> <div class="tabs"> <ul> <li><a href="annotated.html"><span>Class List</span></a></li> <li><a href="classes.html"><span>Class Index</span></a></li> <li><a href="hierarchy.html"><span>Class Hierarchy</span></a></li> <li><a href="functions.html"><span>Class Members</span></a></li> </ul> </div> <div class="navpath"><a class="el" href="namespaceBarry.html">Barry</a>::<b>Sync</b>::<a class="el" href="classBarry_1_1Sync_1_1TzWrapper.html">TzWrapper</a> </div> </div> <div class="contents"> <h1>Barry::Sync::TzWrapper Class Reference</h1><!-- doxytag: class="Barry::Sync::TzWrapper" --> <p>Wrapper class for the TZ environment variable. <a href="#_details">More...</a></p> <p><code>#include <<a class="el" href="tzwrapper_8h_source.html">tzwrapper.h</a>></code></p> <div class="dynheader"> Collaboration diagram for Barry::Sync::TzWrapper:</div> <div class="dynsection"> <div class="center"><img src="classBarry_1_1Sync_1_1TzWrapper__coll__graph.png" border="0" usemap="#Barry_1_1Sync_1_1TzWrapper_coll__map" alt="Collaboration graph"/></div> <map name="Barry_1_1Sync_1_1TzWrapper_coll__map" id="Barry_1_1Sync_1_1TzWrapper_coll__map"> <area shape="rect" id="node2" title="STL class." alt="" coords="49,89,129,119"/><area shape="rect" id="node4" title="STL class." alt="" coords="5,6,173,37"/></map> <center><span class="legend">[<a href="graph_legend.html">legend</a>]</span></center></div> <p><a href="classBarry_1_1Sync_1_1TzWrapper-members.html">List of all members.</a></p> <table border="0" cellpadding="0" cellspacing="0"> <tr><td colspan="2"><h2>Public Member Functions</h2></td></tr> <tr><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classBarry_1_1Sync_1_1TzWrapper.html#ae2873ae6adbe53fd7e61109a4b39b554">TzWrapper</a> ()</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Does not change TZ, only saves current setting. <a href="#ae2873ae6adbe53fd7e61109a4b39b554"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classBarry_1_1Sync_1_1TzWrapper.html#a11b3c0192d3b4eb7471cce7159c3c6a2">TzWrapper</a> (const char *timezone)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Saves current setting and sets TZ to new timezone value. <a href="#a11b3c0192d3b4eb7471cce7159c3c6a2"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="classBarry_1_1Sync_1_1TzWrapper.html">TzWrapper</a> & </td><td class="memItemRight" valign="bottom"><a class="el" href="classBarry_1_1Sync_1_1TzWrapper.html#a46e3e3ec5c35694810271476707a6186">Set</a> (const char *timezone)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Set TZ to a new value. <a href="#a46e3e3ec5c35694810271476707a6186"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="classBarry_1_1Sync_1_1TzWrapper.html">TzWrapper</a> & </td><td class="memItemRight" valign="bottom"><a class="el" href="classBarry_1_1Sync_1_1TzWrapper.html#a27d8874df34bd4f04bd4430d0d4a2523">Unset</a> ()</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Deletes TZ from the environment, which has the same effect as calling <a class="el" href="classBarry_1_1Sync_1_1TzWrapper.html#a64528d9b642db8defc4163c613ff0366" title="Use system localtime.">SetSysLocal()</a>. <a href="#a27d8874df34bd4f04bd4430d0d4a2523"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="classBarry_1_1Sync_1_1TzWrapper.html">TzWrapper</a> & </td><td class="memItemRight" valign="bottom"><a class="el" href="classBarry_1_1Sync_1_1TzWrapper.html#aab3349c356c87e37d41841d78fd8f227">SetUTC</a> ()</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Set timezone to UTC. <a href="#aab3349c356c87e37d41841d78fd8f227"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="classBarry_1_1Sync_1_1TzWrapper.html">TzWrapper</a> & </td><td class="memItemRight" valign="bottom"><a class="el" href="classBarry_1_1Sync_1_1TzWrapper.html#a64528d9b642db8defc4163c613ff0366">SetSysLocal</a> ()</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Use system localtime. <a href="#a64528d9b642db8defc4163c613ff0366"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="classBarry_1_1Sync_1_1TzWrapper.html">TzWrapper</a> & </td><td class="memItemRight" valign="bottom"><a class="el" href="classBarry_1_1Sync_1_1TzWrapper.html#af47fbd57f1417575a1c0c958d57ca395">SetDefault</a> ()</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Use the default TZ value that the user set before running this program. <a href="#af47fbd57f1417575a1c0c958d57ca395"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="classBarry_1_1Sync_1_1TzWrapper.html">TzWrapper</a> & </td><td class="memItemRight" valign="bottom"><a class="el" href="classBarry_1_1Sync_1_1TzWrapper.html#add71d2129221171a01fe5efc5e3aeeab">SetOrig</a> ()</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Same as <a class="el" href="classBarry_1_1Sync_1_1TzWrapper.html#af47fbd57f1417575a1c0c958d57ca395" title="Use the default TZ value that the user set before running this program.">SetDefault()</a>. <a href="#add71d2129221171a01fe5efc5e3aeeab"></a><br/></td></tr> <tr><td colspan="2"><h2>Static Public Member Functions</h2></td></tr> <tr><td class="memItemLeft" align="right" valign="top">static time_t </td><td class="memItemRight" valign="bottom"><a class="el" href="classBarry_1_1Sync_1_1TzWrapper.html#ac1524071e5a61fa789331c9784b6093d">iso_mktime</a> (const char *timestamp)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Converts an ISO timestamp (YYYYMMDDTHHMMWW[Z]) into a unix time_t. <a href="#ac1524071e5a61fa789331c9784b6093d"></a><br/></td></tr> </table> <hr/><a name="_details"></a><h2>Detailed Description</h2> <p>Wrapper class for the TZ environment variable. </p> <p>This class allows setting TZ to any number of variables, and will restore the original setting on destruction.</p> <p>By default, <a class="el" href="classBarry_1_1Sync_1_1TzWrapper.html" title="Wrapper class for the TZ environment variable.">TzWrapper</a> does not change the environment at all, but only saves it. Alternately, you can use the timezone constructor to save and set a new timezone on the fly.</p> <p>Each <a class="el" href="classBarry_1_1Sync_1_1TzWrapper.html#a46e3e3ec5c35694810271476707a6186" title="Set TZ to a new value.">Set()</a> and <a class="el" href="classBarry_1_1Sync_1_1TzWrapper.html#a27d8874df34bd4f04bd4430d0d4a2523" title="Deletes TZ from the environment, which has the same effect as calling SetSysLocal()...">Unset()</a> function returns a reference to <a class="el" href="classBarry_1_1Sync_1_1TzWrapper.html" title="Wrapper class for the TZ environment variable.">TzWrapper</a>, so that you can chain function calls like this:</p> <p>time_t utc = <a class="el" href="classBarry_1_1Sync_1_1TzWrapper.html" title="Wrapper class for the TZ environment variable.">TzWrapper</a>("Canada/Pacific").mktime(&pacific_tm);</p> <p>In addition, there are two static utility functions used to convert ISO timestamps to struct tm* and time_t values.</p> <p>Note: This class is not thread-safe, since it modifies the TZ environment variable without locking. If other threads use time functions, this may interfere with their behaviour. </p> <p>Definition at line <a class="el" href="tzwrapper_8h_source.html#l00085">85</a> of file <a class="el" href="tzwrapper_8h_source.html">tzwrapper.h</a>.</p> <hr/><h2>Constructor & Destructor Documentation</h2> <a class="anchor" id="ae2873ae6adbe53fd7e61109a4b39b554"></a><!-- doxytag: member="Barry::Sync::TzWrapper::TzWrapper" ref="ae2873ae6adbe53fd7e61109a4b39b554" args="()" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">Barry::Sync::TzWrapper::TzWrapper </td> <td>(</td> <td class="paramname"></td> <td> ) </td> <td><code> [inline]</code></td> </tr> </table> </div> <div class="memdoc"> <p>Does not change TZ, only saves current setting. </p> <p>Definition at line <a class="el" href="tzwrapper_8h_source.html#l00114">114</a> of file <a class="el" href="tzwrapper_8h_source.html">tzwrapper.h</a>.</p> </div> </div> <a class="anchor" id="a11b3c0192d3b4eb7471cce7159c3c6a2"></a><!-- doxytag: member="Barry::Sync::TzWrapper::TzWrapper" ref="a11b3c0192d3b4eb7471cce7159c3c6a2" args="(const char *timezone)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">Barry::Sync::TzWrapper::TzWrapper </td> <td>(</td> <td class="paramtype">const char * </td> <td class="paramname"> <em>timezone</em></td> <td> ) </td> <td><code> [inline, explicit]</code></td> </tr> </table> </div> <div class="memdoc"> <p>Saves current setting and sets TZ to new timezone value. </p> <p>If timezone is null, it is the same as calling <a class="el" href="classBarry_1_1Sync_1_1TzWrapper.html#a27d8874df34bd4f04bd4430d0d4a2523" title="Deletes TZ from the environment, which has the same effect as calling SetSysLocal()...">Unset()</a>. </p> <p>Definition at line <a class="el" href="tzwrapper_8h_source.html#l00122">122</a> of file <a class="el" href="tzwrapper_8h_source.html">tzwrapper.h</a>.</p> </div> </div> <hr/><h2>Member Function Documentation</h2> <a class="anchor" id="ac1524071e5a61fa789331c9784b6093d"></a><!-- doxytag: member="Barry::Sync::TzWrapper::iso_mktime" ref="ac1524071e5a61fa789331c9784b6093d" args="(const char *timestamp)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">time_t Barry::Sync::TzWrapper::iso_mktime </td> <td>(</td> <td class="paramtype">const char * </td> <td class="paramname"> <em>timestamp</em></td> <td> ) </td> <td><code> [static]</code></td> </tr> </table> </div> <div class="memdoc"> <p>Converts an ISO timestamp (YYYYMMDDTHHMMWW[Z]) into a unix time_t. </p> <p>If the 'Z' UTC flag is not specified, then the timestamp will be assumed to be in the current default timezone. Otherwise, <a class="el" href="classBarry_1_1Sync_1_1TzWrapper.html#aab3349c356c87e37d41841d78fd8f227" title="Set timezone to UTC.">SetUTC()</a> will be used for the conversion.</p> <p>This function uses an internal <a class="el" href="classBarry_1_1Sync_1_1TzWrapper.html" title="Wrapper class for the TZ environment variable.">TzWrapper</a> to adjust TZ if necessary, which is why it is a static function of <a class="el" href="classBarry_1_1Sync_1_1TzWrapper.html" title="Wrapper class for the TZ environment variable.">TzWrapper</a>, instead of a standalone function. </p> <p>Definition at line <a class="el" href="tzwrapper_8cc_source.html#l00107">107</a> of file <a class="el" href="tzwrapper_8cc_source.html">tzwrapper.cc</a>.</p> <p>References <a class="el" href="tzwrapper_8h_source.html#l00163">SetUTC()</a>.</p> <p>Referenced by <a class="el" href="vbase_8cc_source.html#l00056">Barry::Sync::vTimeConverter::vtime2unix()</a>.</p> <p><div class="dynheader"> Here is the call graph for this function:</div> <div class="dynsection"> <div class="center"><img src="classBarry_1_1Sync_1_1TzWrapper_ac1524071e5a61fa789331c9784b6093d_cgraph.png" border="0" usemap="#classBarry_1_1Sync_1_1TzWrapper_ac1524071e5a61fa789331c9784b6093d_cgraph_map" alt=""></div> <map name="classBarry_1_1Sync_1_1TzWrapper_ac1524071e5a61fa789331c9784b6093d_cgraph_map" id="classBarry_1_1Sync_1_1TzWrapper_ac1524071e5a61fa789331c9784b6093d_cgraph"> <area shape="rect" id="node3" href="classBarry_1_1Sync_1_1TzWrapper.html#aab3349c356c87e37d41841d78fd8f227" title="Set timezone to UTC." alt="" coords="296,5,517,35"/></map> </div> </p> <p><div class="dynheader"> Here is the caller graph for this function:</div> <div class="dynsection"> <div class="center"><img src="classBarry_1_1Sync_1_1TzWrapper_ac1524071e5a61fa789331c9784b6093d_icgraph.png" border="0" usemap="#classBarry_1_1Sync_1_1TzWrapper_ac1524071e5a61fa789331c9784b6093d_icgraph_map" alt=""></div> <map name="classBarry_1_1Sync_1_1TzWrapper_ac1524071e5a61fa789331c9784b6093d_icgraph_map" id="classBarry_1_1Sync_1_1TzWrapper_ac1524071e5a61fa789331c9784b6093d_icgraph"> <area shape="rect" id="node3" href="classBarry_1_1Sync_1_1vTimeConverter.html#a231567ee26a99891dd04f9b4635c702d" title="Convert an ISO timestamp string into a time_t, using the current system timezone..." alt="" coords="296,5,565,35"/></map> </div> </p> </div> </div> <a class="anchor" id="a46e3e3ec5c35694810271476707a6186"></a><!-- doxytag: member="Barry::Sync::TzWrapper::Set" ref="a46e3e3ec5c35694810271476707a6186" args="(const char *timezone)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="classBarry_1_1Sync_1_1TzWrapper.html">TzWrapper</a>& Barry::Sync::TzWrapper::Set </td> <td>(</td> <td class="paramtype">const char * </td> <td class="paramname"> <em>timezone</em></td> <td> ) </td> <td><code> [inline]</code></td> </tr> </table> </div> <div class="memdoc"> <p>Set TZ to a new value. </p> <p>If timezone is null, it is the same as calling <a class="el" href="classBarry_1_1Sync_1_1TzWrapper.html#a27d8874df34bd4f04bd4430d0d4a2523" title="Deletes TZ from the environment, which has the same effect as calling SetSysLocal()...">Unset()</a>.</p> <p>If timezone is an empty or invalid timezone string, it is the same as calling <a class="el" href="classBarry_1_1Sync_1_1TzWrapper.html#aab3349c356c87e37d41841d78fd8f227" title="Set timezone to UTC.">SetUTC()</a>. </p> <p>Definition at line <a class="el" href="tzwrapper_8h_source.html#l00139">139</a> of file <a class="el" href="tzwrapper_8h_source.html">tzwrapper.h</a>.</p> </div> </div> <a class="anchor" id="af47fbd57f1417575a1c0c958d57ca395"></a><!-- doxytag: member="Barry::Sync::TzWrapper::SetDefault" ref="af47fbd57f1417575a1c0c958d57ca395" args="()" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="classBarry_1_1Sync_1_1TzWrapper.html">TzWrapper</a>& Barry::Sync::TzWrapper::SetDefault </td> <td>(</td> <td class="paramname"></td> <td> ) </td> <td><code> [inline]</code></td> </tr> </table> </div> <div class="memdoc"> <p>Use the default TZ value that the user set before running this program. </p> <p>In most cases, this will be the user's preferred local timezone. </p> <p>Definition at line <a class="el" href="tzwrapper_8h_source.html#l00178">178</a> of file <a class="el" href="tzwrapper_8h_source.html">tzwrapper.h</a>.</p> </div> </div> <a class="anchor" id="add71d2129221171a01fe5efc5e3aeeab"></a><!-- doxytag: member="Barry::Sync::TzWrapper::SetOrig" ref="add71d2129221171a01fe5efc5e3aeeab" args="()" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="classBarry_1_1Sync_1_1TzWrapper.html">TzWrapper</a>& Barry::Sync::TzWrapper::SetOrig </td> <td>(</td> <td class="paramname"></td> <td> ) </td> <td><code> [inline]</code></td> </tr> </table> </div> <div class="memdoc"> <p>Same as <a class="el" href="classBarry_1_1Sync_1_1TzWrapper.html#af47fbd57f1417575a1c0c958d57ca395" title="Use the default TZ value that the user set before running this program.">SetDefault()</a>. </p> <p>Definition at line <a class="el" href="tzwrapper_8h_source.html#l00184">184</a> of file <a class="el" href="tzwrapper_8h_source.html">tzwrapper.h</a>.</p> </div> </div> <a class="anchor" id="a64528d9b642db8defc4163c613ff0366"></a><!-- doxytag: member="Barry::Sync::TzWrapper::SetSysLocal" ref="a64528d9b642db8defc4163c613ff0366" args="()" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="classBarry_1_1Sync_1_1TzWrapper.html">TzWrapper</a>& Barry::Sync::TzWrapper::SetSysLocal </td> <td>(</td> <td class="paramname"></td> <td> ) </td> <td><code> [inline]</code></td> </tr> </table> </div> <div class="memdoc"> <p>Use system localtime. </p> <p>This overrides any TZ value that the user may have set before running your program. </p> <p>Definition at line <a class="el" href="tzwrapper_8h_source.html#l00170">170</a> of file <a class="el" href="tzwrapper_8h_source.html">tzwrapper.h</a>.</p> </div> </div> <a class="anchor" id="aab3349c356c87e37d41841d78fd8f227"></a><!-- doxytag: member="Barry::Sync::TzWrapper::SetUTC" ref="aab3349c356c87e37d41841d78fd8f227" args="()" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="classBarry_1_1Sync_1_1TzWrapper.html">TzWrapper</a>& Barry::Sync::TzWrapper::SetUTC </td> <td>(</td> <td class="paramname"></td> <td> ) </td> <td><code> [inline]</code></td> </tr> </table> </div> <div class="memdoc"> <p>Set timezone to UTC. </p> <p>Definition at line <a class="el" href="tzwrapper_8h_source.html#l00163">163</a> of file <a class="el" href="tzwrapper_8h_source.html">tzwrapper.h</a>.</p> <p>Referenced by <a class="el" href="tzwrapper_8cc_source.html#l00107">iso_mktime()</a>.</p> <p><div class="dynheader"> Here is the caller graph for this function:</div> <div class="dynsection"> <div class="center"><img src="classBarry_1_1Sync_1_1TzWrapper_aab3349c356c87e37d41841d78fd8f227_icgraph.png" border="0" usemap="#classBarry_1_1Sync_1_1TzWrapper_aab3349c356c87e37d41841d78fd8f227_icgraph_map" alt=""></div> <map name="classBarry_1_1Sync_1_1TzWrapper_aab3349c356c87e37d41841d78fd8f227_icgraph_map" id="classBarry_1_1Sync_1_1TzWrapper_aab3349c356c87e37d41841d78fd8f227_icgraph"> <area shape="rect" id="node3" href="classBarry_1_1Sync_1_1TzWrapper.html#ac1524071e5a61fa789331c9784b6093d" title="Converts an ISO timestamp (YYYYMMDDTHHMMWW[Z]) into a unix time_t." alt="" coords="276,5,516,35"/><area shape="rect" id="node5" href="classBarry_1_1Sync_1_1vTimeConverter.html#a231567ee26a99891dd04f9b4635c702d" title="Convert an ISO timestamp string into a time_t, using the current system timezone..." alt="" coords="565,5,835,35"/></map> </div> </p> </div> </div> <a class="anchor" id="a27d8874df34bd4f04bd4430d0d4a2523"></a><!-- doxytag: member="Barry::Sync::TzWrapper::Unset" ref="a27d8874df34bd4f04bd4430d0d4a2523" args="()" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="classBarry_1_1Sync_1_1TzWrapper.html">TzWrapper</a>& Barry::Sync::TzWrapper::Unset </td> <td>(</td> <td class="paramname"></td> <td> ) </td> <td><code> [inline]</code></td> </tr> </table> </div> <div class="memdoc"> <p>Deletes TZ from the environment, which has the same effect as calling <a class="el" href="classBarry_1_1Sync_1_1TzWrapper.html#a64528d9b642db8defc4163c613ff0366" title="Use system localtime.">SetSysLocal()</a>. </p> <p>This is not a permanent condition, since TZ will be restored to original state upon destruction. </p> <p>Definition at line <a class="el" href="tzwrapper_8h_source.html#l00154">154</a> of file <a class="el" href="tzwrapper_8h_source.html">tzwrapper.h</a>.</p> </div> </div> <hr/>The documentation for this class was generated from the following files:<ul> <li><a class="el" href="tzwrapper_8h_source.html">tzwrapper.h</a></li> <li><a class="el" href="tzwrapper_8cc_source.html">tzwrapper.cc</a></li> </ul> </div> <hr class="footer"/><address style="text-align: right;"><small>Generated by <a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.2-20100208 </small></address> </body> </html>