📄 apr__time_8h-source.html
字号:
<!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.7 -->
<div class="qindex"><a class="qindex" href="index.html">Main Page</a> | <a class="qindex" href="modules.html">Modules</a> | <a class="qindex" href="annotated.html">Data Structures</a> | <a class="qindex" href="files.html">File List</a> | <a class="qindex" href="functions.html">Data Fields</a> | <a class="qindex" href="globals.html">Globals</a> | <a class="qindex" href="pages.html">Related Pages</a></div>
<h1>apr_time.h</h1><a href="apr__time_8h.html">Go to the documentation of this file.</a><pre class="fragment"><div>00001 <span class="comment">/* Copyright 2000-2005 The Apache Software Foundation or its licensors, as</span>
00002 <span class="comment"> * applicable.</span>
00003 <span class="comment"> *</span>
00004 <span class="comment"> * Licensed under the Apache License, Version 2.0 (the "License");</span>
00005 <span class="comment"> * you may not use this file except in compliance with the License.</span>
00006 <span class="comment"> * You may obtain a copy of the License at</span>
00007 <span class="comment"> *</span>
00008 <span class="comment"> * http://www.apache.org/licenses/LICENSE-2.0</span>
00009 <span class="comment"> *</span>
00010 <span class="comment"> * Unless required by applicable law or agreed to in writing, software</span>
00011 <span class="comment"> * distributed under the License is distributed on an "AS IS" BASIS,</span>
00012 <span class="comment"> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.</span>
00013 <span class="comment"> * See the License for the specific language governing permissions and</span>
00014 <span class="comment"> * limitations under the License.</span>
00015 <span class="comment"> */</span>
00016
00017 <span class="preprocessor">#ifndef APR_TIME_H</span>
00018 <span class="preprocessor"></span><span class="preprocessor">#define APR_TIME_H</span>
00019 <span class="preprocessor"></span><span class="comment"></span>
00020 <span class="comment">/**</span>
00021 <span class="comment"> * @file apr_time.h</span>
00022 <span class="comment"> * @brief APR Time Library</span>
00023 <span class="comment"> */</span>
00024
00025 <span class="preprocessor">#include "apr.h"</span>
00026 <span class="preprocessor">#include "<a class="code" href="apr__pools_8h.html">apr_pools.h</a>"</span>
00027 <span class="preprocessor">#include "<a class="code" href="apr__errno_8h.html">apr_errno.h</a>"</span>
00028
00029 <span class="preprocessor">#ifdef __cplusplus</span>
00030 <span class="preprocessor"></span><span class="keyword">extern</span> <span class="stringliteral">"C"</span> {
00031 <span class="preprocessor">#endif </span><span class="comment">/* __cplusplus */</span>
00032 <span class="comment"></span>
00033 <span class="comment">/**</span>
00034 <span class="comment"> * @defgroup apr_time Time Routines</span>
00035 <span class="comment"> * @ingroup APR </span>
00036 <span class="comment"> * @{</span>
00037 <span class="comment"> */</span>
00038 <span class="comment"></span>
00039 <span class="comment">/** month names */</span>
<a name="l00040"></a><a class="code" href="group__apr__time.html#ga0">00040</a> APR_DECLARE_DATA <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>
00041 <span class="comment">/** day names */</span>
<a name="l00042"></a><a class="code" href="group__apr__time.html#ga1">00042</a> APR_DECLARE_DATA <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];
00043
00044 <span class="comment"></span>
00045 <span class="comment">/** number of microseconds since 00:00:00 january 1, 1970 UTC */</span>
<a name="l00046"></a><a class="code" href="group__apr__time.html#ga2">00046</a> <span class="keyword">typedef</span> apr_int64_t <a class="code" href="group__apr__time.html#ga2">apr_time_t</a>;
00047
00048 <span class="comment"></span>
00049 <span class="comment">/** mechanism to properly type apr_time_t literals */</span>
<a name="l00050"></a><a class="code" href="group__apr__time.html#ga18">00050</a> <span class="preprocessor">#define APR_TIME_C(val) APR_INT64_C(val)</span>
00051 <span class="preprocessor"></span><span class="comment"></span>
00052 <span class="comment">/** mechanism to properly print apr_time_t values */</span>
<a name="l00053"></a><a class="code" href="group__apr__time.html#ga19">00053</a> <span class="preprocessor">#define APR_TIME_T_FMT APR_INT64_T_FMT</span>
00054 <span class="preprocessor"></span><span class="comment"></span>
00055 <span class="comment">/** intervals for I/O timeouts, in microseconds */</span>
<a name="l00056"></a><a class="code" href="group__apr__time.html#ga3">00056</a> <span class="keyword">typedef</span> apr_int64_t <a class="code" href="group__apr__time.html#ga3">apr_interval_time_t</a>;<span class="comment"></span>
00057 <span class="comment">/** short interval for I/O timeouts, in microseconds */</span>
<a name="l00058"></a><a class="code" href="group__apr__time.html#ga4">00058</a> <span class="keyword">typedef</span> apr_int32_t <a class="code" href="group__apr__time.html#ga4">apr_short_interval_time_t</a>;
00059 <span class="comment"></span>
00060 <span class="comment">/** number of microseconds per second */</span>
<a name="l00061"></a><a class="code" href="group__apr__time.html#ga20">00061</a> <span class="preprocessor">#define APR_USEC_PER_SEC APR_TIME_C(1000000)</span>
00062 <span class="preprocessor"></span><span class="comment"></span>
00063 <span class="comment">/** @return apr_time_t as a second */</span>
<a name="l00064"></a><a class="code" href="group__apr__time.html#ga21">00064</a> <span class="preprocessor">#define apr_time_sec(time) ((time) / APR_USEC_PER_SEC)</span>
00065 <span class="preprocessor"></span><span class="comment"></span>
00066 <span class="comment">/** @return apr_time_t as a usec */</span>
<a name="l00067"></a><a class="code" href="group__apr__time.html#ga22">00067</a> <span class="preprocessor">#define apr_time_usec(time) ((time) % APR_USEC_PER_SEC)</span>
00068 <span class="preprocessor"></span><span class="comment"></span>
00069 <span class="comment">/** @return apr_time_t as a msec */</span>
<a name="l00070"></a><a class="code" href="group__apr__time.html#ga23">00070</a> <span class="preprocessor">#define apr_time_msec(time) (((time) / 1000) % 1000)</span>
00071 <span class="preprocessor"></span><span class="comment"></span>
00072 <span class="comment">/** @return apr_time_t as a msec */</span>
<a name="l00073"></a><a class="code" href="group__apr__time.html#ga24">00073</a> <span class="preprocessor">#define apr_time_as_msec(time) ((time) / 1000)</span>
00074 <span class="preprocessor"></span><span class="comment"></span>
00075 <span class="comment">/** @return a second as an apr_time_t */</span>
<a name="l00076"></a><a class="code" href="group__apr__time.html#ga25">00076</a> <span class="preprocessor">#define apr_time_from_sec(sec) ((apr_time_t)(sec) * APR_USEC_PER_SEC)</span>
00077 <span class="preprocessor"></span><span class="comment"></span>
00078 <span class="comment">/** @return a second and usec combination as an apr_time_t */</span>
<a name="l00079"></a><a class="code" href="group__apr__time.html#ga26">00079</a> <span class="preprocessor">#define apr_time_make(sec, usec) ((apr_time_t)(sec) * APR_USEC_PER_SEC \</span>
00080 <span class="preprocessor"> + (apr_time_t)(usec))</span>
00081 <span class="preprocessor"></span><span class="comment"></span>
00082 <span class="comment">/**</span>
00083 <span class="comment"> * @return the current time</span>
00084 <span class="comment"> */</span>
00085 APR_DECLARE(apr_time_t) apr_time_now(<span class="keywordtype">void</span>);
00086 <span class="comment"></span>
00087 <span class="comment">/** @see apr_time_exp_t */</span>
<a name="l00088"></a><a class="code" href="group__apr__time.html#ga5">00088</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>;
00089 <span class="comment"></span>
00090 <span class="comment">/**</span>
00091 <span class="comment"> * a structure similar to ANSI struct tm with the following differences:</span>
00092 <span class="comment"> * - tm_usec isn't an ANSI field</span>
00093 <span class="comment"> * - tm_gmtoff isn't an ANSI field (it's a bsdism)</span>
00094 <span class="comment"> */</span>
<a name="l00095"></a><a class="code" href="structapr__time__exp__t.html">00095</a> struct apr_time_exp_t {<span class="comment"></span>
00096 <span class="comment"> /** microseconds past tm_sec */</span>
<a name="l00097"></a><a class="code" href="structapr__time__exp__t.html#o0">00097</a> apr_int32_t tm_usec;<span class="comment"></span>
00098 <span class="comment"> /** (0-61) seconds past tm_min */</span>
<a name="l00099"></a><a class="code" href="structapr__time__exp__t.html#o1">00099</a> apr_int32_t tm_sec;<span class="comment"></span>
00100 <span class="comment"> /** (0-59) minutes past tm_hour */</span>
<a name="l00101"></a><a class="code" href="structapr__time__exp__t.html#o2">00101</a> apr_int32_t tm_min;<span class="comment"></span>
00102 <span class="comment"> /** (0-23) hours past midnight */</span>
<a name="l00103"></a><a class="code" href="structapr__time__exp__t.html#o3">00103</a> apr_int32_t tm_hour;<span class="comment"></span>
00104 <span class="comment"> /** (1-31) day of the month */</span>
<a name="l00105"></a><a class="code" href="structapr__time__exp__t.html#o4">00105</a> apr_int32_t tm_mday;<span class="comment"></span>
00106 <span class="comment"> /** (0-11) month of the year */</span>
<a name="l00107"></a><a class="code" href="structapr__time__exp__t.html#o5">00107</a> apr_int32_t tm_mon;<span class="comment"></span>
00108 <span class="comment"> /** year since 1900 */</span>
<a name="l00109"></a><a class="code" href="structapr__time__exp__t.html#o6">00109</a> apr_int32_t tm_year;<span class="comment"></span>
00110 <span class="comment"> /** (0-6) days since sunday */</span>
<a name="l00111"></a><a class="code" href="structapr__time__exp__t.html#o7">00111</a> apr_int32_t tm_wday;<span class="comment"></span>
00112 <span class="comment"> /** (0-365) days since jan 1 */</span>
<a name="l00113"></a><a class="code" href="structapr__time__exp__t.html#o8">00113</a> apr_int32_t tm_yday;<span class="comment"></span>
00114 <span class="comment"> /** daylight saving time */</span>
<a name="l00115"></a><a class="code" href="structapr__time__exp__t.html#o9">00115</a> apr_int32_t tm_isdst;<span class="comment"></span>
00116 <span class="comment"> /** seconds east of UTC */</span>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -