Sophie

Sophie

distrib > Mandriva > 10.2 > i586 > by-pkgid > 4f37b923758ceff94a2c0ccca62b4b43 > files > 118

libapr1-devel-1.1.1-1mdk.i586.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>Apache Portable Runtime: apr_time.h Source File</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.3.9.1 -->
<div class="qindex"><a class="qindex" href="index.html">Main&nbsp;Page</a> | <a class="qindex" href="modules.html">Modules</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a> | <a class="qindex" href="pages.html">Related&nbsp;Pages</a></div>
<div class="nav">
<a class="el" href="dir_000000.html">home</a>&nbsp;/&nbsp;<a class="el" href="dir_000001.html">oden</a>&nbsp;/&nbsp;<a class="el" href="dir_000002.html">RPM</a>&nbsp;/&nbsp;<a class="el" href="dir_000003.html">BUILD</a>&nbsp;/&nbsp;<a class="el" href="dir_000004.html">apr-1.1.1</a>&nbsp;/&nbsp;<a class="el" href="dir_000005.html">include</a></div>
<h1>apr_time.h</h1><a href="apr__time_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment">00001 <span class="comment">/* Copyright 2000-2004 The Apache Software Foundation</span>
00002 <span class="comment"> *</span>
00003 <span class="comment"> * Licensed under the Apache License, Version 2.0 (the "License");</span>
00004 <span class="comment"> * you may not use this file except in compliance with the License.</span>
00005 <span class="comment"> * You may obtain a copy of the License at</span>
00006 <span class="comment"> *</span>
00007 <span class="comment"> *     http://www.apache.org/licenses/LICENSE-2.0</span>
00008 <span class="comment"> *</span>
00009 <span class="comment"> * Unless required by applicable law or agreed to in writing, software</span>
00010 <span class="comment"> * distributed under the License is distributed on an "AS IS" BASIS,</span>
00011 <span class="comment"> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.</span>
00012 <span class="comment"> * See the License for the specific language governing permissions and</span>
00013 <span class="comment"> * limitations under the License.</span>
00014 <span class="comment"> */</span>
00015 
00016 <span class="preprocessor">#ifndef APR_TIME_H</span>
00017 <span class="preprocessor"></span><span class="preprocessor">#define APR_TIME_H</span>
00018 <span class="preprocessor"></span><span class="comment"></span>
00019 <span class="comment">/**</span>
00020 <span class="comment"> * @file apr_time.h</span>
00021 <span class="comment"> * @brief APR Time Library</span>
00022 <span class="comment"> */</span>
00023 
00024 <span class="preprocessor">#include "<a class="code" href="apr_8h.html">apr.h</a>"</span>
00025 <span class="preprocessor">#include "<a class="code" href="apr__pools_8h.html">apr_pools.h</a>"</span>
00026 <span class="preprocessor">#include "<a class="code" href="apr__errno_8h.html">apr_errno.h</a>"</span>
00027 
00028 <span class="preprocessor">#ifdef __cplusplus</span>
00029 <span class="preprocessor"></span><span class="keyword">extern</span> <span class="stringliteral">"C"</span> {
00030 <span class="preprocessor">#endif </span><span class="comment">/* __cplusplus */</span>
00031 <span class="comment"></span>
00032 <span class="comment">/**</span>
00033 <span class="comment"> * @defgroup apr_time Time Routines</span>
00034 <span class="comment"> * @ingroup APR </span>
00035 <span class="comment"> * @{</span>
00036 <span class="comment"> */</span>
00037 <span class="comment"></span>
00038 <span class="comment">/** month names */</span>
00039 <a class="code" href="group__apr__platform.html#ga125">APR_DECLARE_DATA</a> <span class="keyword">extern</span> <span class="keyword">const</span> <span class="keywordtype">char</span> <a class="code" href="group__apr__time.html#ga0">apr_month_snames</a>[12][4];<span class="comment"></span>
00040 <span class="comment">/** day names */</span>
00041 <a class="code" href="group__apr__platform.html#ga125">APR_DECLARE_DATA</a> <span class="keyword">extern</span> <span class="keyword">const</span> <span class="keywordtype">char</span> <a class="code" href="group__apr__time.html#ga1">apr_day_snames</a>[7][4];
00042 
00043 <span class="comment"></span>
00044 <span class="comment">/** number of microseconds since 00:00:00 january 1, 1970 UTC */</span>
<a name="l00045"></a><a class="code" href="group__apr__time.html#ga2">00045</a> <span class="keyword">typedef</span> apr_int64_t apr_time_t;
00046 
00047 <span class="comment"></span>
00048 <span class="comment">/** mechanism to properly type apr_time_t literals */</span>
<a name="l00049"></a><a class="code" href="group__apr__time.html#ga18">00049</a> <span class="preprocessor">#define APR_TIME_C(val) APR_INT64_C(val)</span>
00050 <span class="preprocessor"></span><span class="comment"></span>
00051 <span class="comment">/** mechanism to properly print apr_time_t values */</span>
<a name="l00052"></a><a class="code" href="group__apr__time.html#ga19">00052</a> <span class="preprocessor">#define APR_TIME_T_FMT APR_INT64_T_FMT</span>
00053 <span class="preprocessor"></span><span class="comment"></span>
00054 <span class="comment">/** intervals for I/O timeouts, in microseconds */</span>
<a name="l00055"></a><a class="code" href="group__apr__time.html#ga3">00055</a> <span class="keyword">typedef</span> apr_int64_t apr_interval_time_t;<span class="comment"></span>
00056 <span class="comment">/** short interval for I/O timeouts, in microseconds */</span>
<a name="l00057"></a><a class="code" href="group__apr__time.html#ga4">00057</a> <span class="keyword">typedef</span> apr_int32_t apr_short_interval_time_t;
00058 <span class="comment"></span>
00059 <span class="comment">/** number of microseconds per second */</span>
<a name="l00060"></a><a class="code" href="group__apr__time.html#ga20">00060</a> <span class="preprocessor">#define APR_USEC_PER_SEC APR_TIME_C(1000000)</span>
00061 <span class="preprocessor"></span><span class="comment"></span>
00062 <span class="comment">/** @return apr_time_t as a second */</span>
<a name="l00063"></a><a class="code" href="group__apr__time.html#ga21">00063</a> <span class="preprocessor">#define apr_time_sec(time) ((time) / APR_USEC_PER_SEC)</span>
00064 <span class="preprocessor"></span><span class="comment"></span>
00065 <span class="comment">/** @return apr_time_t as a usec */</span>
<a name="l00066"></a><a class="code" href="group__apr__time.html#ga22">00066</a> <span class="preprocessor">#define apr_time_usec(time) ((time) % APR_USEC_PER_SEC)</span>
00067 <span class="preprocessor"></span><span class="comment"></span>
00068 <span class="comment">/** @return apr_time_t as a msec */</span>
<a name="l00069"></a><a class="code" href="group__apr__time.html#ga23">00069</a> <span class="preprocessor">#define apr_time_msec(time) (((time) / 1000) % 1000)</span>
00070 <span class="preprocessor"></span><span class="comment"></span>
00071 <span class="comment">/** @return apr_time_t as a msec */</span>
<a name="l00072"></a><a class="code" href="group__apr__time.html#ga24">00072</a> <span class="preprocessor">#define apr_time_as_msec(time) ((time) / 1000)</span>
00073 <span class="preprocessor"></span><span class="comment"></span>
00074 <span class="comment">/** @return a second as an apr_time_t */</span>
<a name="l00075"></a><a class="code" href="group__apr__time.html#ga25">00075</a> <span class="preprocessor">#define apr_time_from_sec(sec) ((apr_time_t)(sec) * APR_USEC_PER_SEC)</span>
00076 <span class="preprocessor"></span><span class="comment"></span>
00077 <span class="comment">/** @return a second and usec combination as an apr_time_t */</span>
<a name="l00078"></a><a class="code" href="group__apr__time.html#ga26">00078</a> <span class="preprocessor">#define apr_time_make(sec, usec) ((apr_time_t)(sec) * APR_USEC_PER_SEC \</span>
00079 <span class="preprocessor">                                + (apr_time_t)(usec))</span>
00080 <span class="preprocessor"></span><span class="comment"></span>
00081 <span class="comment">/**</span>
00082 <span class="comment"> * @return the current time</span>
00083 <span class="comment"> */</span>
00084 <a class="code" href="group__apr__platform.html#ga123">APR_DECLARE</a>(apr_time_t) apr_time_now(<span class="keywordtype">void</span>);
00085 <span class="comment"></span>
00086 <span class="comment">/** @see apr_time_exp_t */</span>
<a name="l00087"></a><a class="code" href="group__apr__time.html#ga5">00087</a> typedef struct <a class="code" href="structapr__time__exp__t.html">apr_time_exp_t</a> <a class="code" href="structapr__time__exp__t.html">apr_time_exp_t</a>;
00088 <span class="comment"></span>
00089 <span class="comment">/**</span>
00090 <span class="comment"> * a structure similar to ANSI struct tm with the following differences:</span>
00091 <span class="comment"> *  - tm_usec isn't an ANSI field</span>
00092 <span class="comment"> *  - tm_gmtoff isn't an ANSI field (it's a bsdism)</span>
00093 <span class="comment"> */</span>
<a name="l00094"></a><a class="code" href="structapr__time__exp__t.html">00094</a> struct apr_time_exp_t {<span class="comment"></span>
00095 <span class="comment">    /** microseconds past tm_sec */</span>
<a name="l00096"></a><a class="code" href="structapr__time__exp__t.html#o0">00096</a>     apr_int32_t tm_usec;<span class="comment"></span>
00097 <span class="comment">    /** (0-61) seconds past tm_min */</span>
<a name="l00098"></a><a class="code" href="structapr__time__exp__t.html#o1">00098</a>     apr_int32_t tm_sec;<span class="comment"></span>
00099 <span class="comment">    /** (0-59) minutes past tm_hour */</span>
<a name="l00100"></a><a class="code" href="structapr__time__exp__t.html#o2">00100</a>     apr_int32_t tm_min;<span class="comment"></span>
00101 <span class="comment">    /** (0-23) hours past midnight */</span>
<a name="l00102"></a><a class="code" href="structapr__time__exp__t.html#o3">00102</a>     apr_int32_t tm_hour;<span class="comment"></span>
00103 <span class="comment">    /** (1-31) day of the month */</span>
<a name="l00104"></a><a class="code" href="structapr__time__exp__t.html#o4">00104</a>     apr_int32_t tm_mday;<span class="comment"></span>
00105 <span class="comment">    /** (0-11) month of the year */</span>
<a name="l00106"></a><a class="code" href="structapr__time__exp__t.html#o5">00106</a>     apr_int32_t tm_mon;<span class="comment"></span>
00107 <span class="comment">    /** year since 1900 */</span>
<a name="l00108"></a><a class="code" href="structapr__time__exp__t.html#o6">00108</a>     apr_int32_t tm_year;<span class="comment"></span>
00109 <span class="comment">    /** (0-6) days since sunday */</span>
<a name="l00110"></a><a class="code" href="structapr__time__exp__t.html#o7">00110</a>     apr_int32_t tm_wday;<span class="comment"></span>
00111 <span class="comment">    /** (0-365) days since jan 1 */</span>
<a name="l00112"></a><a class="code" href="structapr__time__exp__t.html#o8">00112</a>     apr_int32_t tm_yday;<span class="comment"></span>
00113 <span class="comment">    /** daylight saving time */</span>
<a name="l00114"></a><a class="code" href="structapr__time__exp__t.html#o9">00114</a>     apr_int32_t tm_isdst;<span class="comment"></span>
00115 <span class="comment">    /** seconds east of UTC */</span>
<a name="l00116"></a><a class="code" href="structapr__time__exp__t.html#o10">00116</a>     apr_int32_t tm_gmtoff;
00117 };
00118 <span class="comment"></span>
00119 <span class="comment">/**</span>
00120 <span class="comment"> * convert an ansi time_t to an apr_time_t</span>
00121 <span class="comment"> * @param result the resulting apr_time_t</span>
00122 <span class="comment"> * @param input the time_t to convert</span>
00123 <span class="comment"> */</span>
00124 <a class="code" href="group__apr__platform.html#ga123">APR_DECLARE</a>(apr_status_t) apr_time_ansi_put(apr_time_t *result, 
00125                                                     time_t input);
00126 <span class="comment"></span>
00127 <span class="comment">/**</span>
00128 <span class="comment"> * convert a time to its human readable components using an offset</span>
00129 <span class="comment"> * from GMT</span>
00130 <span class="comment"> * @param result the exploded time</span>
00131 <span class="comment"> * @param input the time to explode</span>
00132 <span class="comment"> * @param offs the number of seconds offset to apply</span>
00133 <span class="comment"> */</span>
00134 APR_DECLARE(apr_status_t) apr_time_exp_tz(<a class="code" href="structapr__time__exp__t.html">apr_time_exp_t</a> *result,
00135                                           apr_time_t input,
00136                                           apr_int32_t offs);
00137 <span class="comment"></span>
00138 <span class="comment">/**</span>
00139 <span class="comment"> * convert a time to its human readable components in GMT timezone</span>
00140 <span class="comment"> * @param result the exploded time</span>
00141 <span class="comment"> * @param input the time to explode</span>
00142 <span class="comment"> */</span>
00143 APR_DECLARE(apr_status_t) apr_time_exp_gmt(<a class="code" href="structapr__time__exp__t.html">apr_time_exp_t</a> *result, 
00144                                            apr_time_t input);
00145 <span class="comment"></span>
00146 <span class="comment">/**</span>
00147 <span class="comment"> * convert a time to its human readable components in local timezone</span>
00148 <span class="comment"> * @param result the exploded time</span>
00149 <span class="comment"> * @param input the time to explode</span>
00150 <span class="comment"> */</span>
00151 APR_DECLARE(apr_status_t) apr_time_exp_lt(<a class="code" href="structapr__time__exp__t.html">apr_time_exp_t</a> *result, 
00152                                           apr_time_t input);
00153 <span class="comment"></span>
00154 <span class="comment">/**</span>
00155 <span class="comment"> * Convert time value from human readable format to a numeric apr_time_t </span>
00156 <span class="comment"> * e.g. elapsed usec since epoch</span>
00157 <span class="comment"> * @param result the resulting imploded time</span>
00158 <span class="comment"> * @param input the input exploded time</span>
00159 <span class="comment"> */</span>
00160 APR_DECLARE(apr_status_t) apr_time_exp_get(apr_time_t *result, 
00161                                            <a class="code" href="structapr__time__exp__t.html">apr_time_exp_t</a> *input);
00162 <span class="comment"></span>
00163 <span class="comment">/**</span>
00164 <span class="comment"> * Convert time value from human readable format to a numeric apr_time_t that</span>
00165 <span class="comment"> * always represents GMT</span>
00166 <span class="comment"> * @param result the resulting imploded time</span>
00167 <span class="comment"> * @param input the input exploded time</span>
00168 <span class="comment"> */</span>
00169 APR_DECLARE(apr_status_t) apr_time_exp_gmt_get(apr_time_t *result, 
00170                                                <a class="code" href="structapr__time__exp__t.html">apr_time_exp_t</a> *input);
00171 <span class="comment"></span>
00172 <span class="comment">/**</span>
00173 <span class="comment"> * Sleep for the specified number of micro-seconds.</span>
00174 <span class="comment"> * @param t desired amount of time to sleep.</span>
00175 <span class="comment"> * @warning May sleep for longer than the specified time. </span>
00176 <span class="comment"> */</span>
00177 APR_DECLARE(<span class="keywordtype">void</span>) apr_sleep(apr_interval_time_t t);
00178 <span class="comment"></span>
00179 <span class="comment">/** length of a RFC822 Date */</span>
<a name="l00180"></a><a class="code" href="group__apr__time.html#ga27">00180</a> #define APR_RFC822_DATE_LEN (30)<span class="comment"></span>
00181 <span class="comment">/**</span>
00182 <span class="comment"> * apr_rfc822_date formats dates in the RFC822</span>
00183 <span class="comment"> * format in an efficient manner.  It is a fixed length</span>
00184 <span class="comment"> * format which requires the indicated amount of storage,</span>
00185 <span class="comment"> * including the trailing NUL terminator.</span>
00186 <span class="comment"> * @param date_str String to write to.</span>
00187 <span class="comment"> * @param t the time to convert </span>
00188 <span class="comment"> */</span>
00189 APR_DECLARE(apr_status_t) apr_rfc822_date(<span class="keywordtype">char</span> *date_str, apr_time_t t);
00190 <span class="comment"></span>
00191 <span class="comment">/** length of a CTIME date */</span>
<a name="l00192"></a><a class="code" href="group__apr__time.html#ga28">00192</a> #define APR_CTIME_LEN (25)<span class="comment"></span>
00193 <span class="comment">/**</span>
00194 <span class="comment"> * apr_ctime formats dates in the ctime() format</span>
00195 <span class="comment"> * in an efficient manner.  it is a fixed length format</span>
00196 <span class="comment"> * and requires the indicated amount of storage including</span>
00197 <span class="comment"> * the trailing NUL terminator.</span>
00198 <span class="comment"> * Unlike ANSI/ISO C ctime(), apr_ctime() does not include</span>
00199 <span class="comment"> * a \n at the end of the string.</span>
00200 <span class="comment"> * @param date_str String to write to.</span>
00201 <span class="comment"> * @param t the time to convert </span>
00202 <span class="comment"> */</span>
00203 APR_DECLARE(apr_status_t) apr_ctime(<span class="keywordtype">char</span> *date_str, apr_time_t t);
00204 <span class="comment"></span>
00205 <span class="comment">/**</span>
00206 <span class="comment"> * formats the exploded time according to the format specified</span>
00207 <span class="comment"> * @param s string to write to</span>
00208 <span class="comment"> * @param retsize The length of the returned string</span>
00209 <span class="comment"> * @param max The maximum length of the string</span>
00210 <span class="comment"> * @param format The format for the time string</span>
00211 <span class="comment"> * @param tm The time to convert</span>
00212 <span class="comment"> */</span>
00213 APR_DECLARE(apr_status_t) apr_strftime(<span class="keywordtype">char</span> *s, apr_size_t *retsize, 
00214                                        apr_size_t max, const <span class="keywordtype">char</span> *format, 
00215                                        <a class="code" href="structapr__time__exp__t.html">apr_time_exp_t</a> *tm);
00216 <span class="comment"></span>
00217 <span class="comment">/**</span>
00218 <span class="comment"> * Improve the clock resolution for the lifetime of the given pool.</span>
00219 <span class="comment"> * Generally this is only desireable on benchmarking and other very</span>
00220 <span class="comment"> * time-sensitive applications, and has no impact on most platforms.</span>
00221 <span class="comment"> * @param p The pool to associate the finer clock resolution </span>
00222 <span class="comment"> */</span>
00223 APR_DECLARE(<span class="keywordtype">void</span>) apr_time_clock_hires(apr_pool_t *p);
00224 <span class="comment"></span>
00225 <span class="comment">/** @} */</span>
00226 
00227 #ifdef __cplusplus
00228 }
00229 #endif
00230 
00231 #endif  <span class="comment">/* ! APR_TIME_H */</span>
</pre></div><hr size="1"><address style="align: right;"><small>Generated on Sun Mar 20 19:52:26 2005 for Apache Portable Runtime by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.3.9.1 </small></address>
</body>
</html>