Main Page | Modules | Data Structures | File List | Data Fields | Globals | Related Pages

apr_time.h

Go to the documentation of this file.
00001 /* Copyright 2000-2004 The Apache Software Foundation
00002  *
00003  * Licensed under the Apache License, Version 2.0 (the "License");
00004  * you may not use this file except in compliance with the License.
00005  * You may obtain a copy of the License at
00006  *
00007  *     http://www.apache.org/licenses/LICENSE-2.0
00008  *
00009  * Unless required by applicable law or agreed to in writing, software
00010  * distributed under the License is distributed on an "AS IS" BASIS,
00011  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00012  * See the License for the specific language governing permissions and
00013  * limitations under the License.
00014  */
00015 
00016 #ifndef APR_TIME_H
00017 #define APR_TIME_H
00018 
00024 #include "apr.h"
00025 #include "apr_pools.h"
00026 #include "apr_errno.h"
00027 
00028 #ifdef __cplusplus
00029 extern "C" {
00030 #endif /* __cplusplus */
00031 
00039 APR_DECLARE_DATA extern const char apr_month_snames[12][4];
00041 APR_DECLARE_DATA extern const char apr_day_snames[7][4];
00042 
00043 
00045 typedef apr_int64_t apr_time_t;
00046 
00047 
00049 #define APR_TIME_C(val) APR_INT64_C(val)
00050 
00052 #define APR_TIME_T_FMT APR_INT64_T_FMT
00053 
00055 typedef apr_int64_t apr_interval_time_t;
00057 typedef apr_int32_t apr_short_interval_time_t;
00058 
00060 #define APR_USEC_PER_SEC APR_TIME_C(1000000)
00061 
00063 #define apr_time_sec(time) ((time) / APR_USEC_PER_SEC)
00064 
00066 #define apr_time_usec(time) ((time) % APR_USEC_PER_SEC)
00067 
00069 #define apr_time_msec(time) (((time) / 1000) % 1000)
00070 
00072 #define apr_time_as_msec(time) ((time) / 1000)
00073 
00075 #define apr_time_from_sec(sec) ((apr_time_t)(sec) * APR_USEC_PER_SEC)
00076 
00078 #define apr_time_make(sec, usec) ((apr_time_t)(sec) * APR_USEC_PER_SEC \
00079                                 + (apr_time_t)(usec))
00080 
00084 APR_DECLARE(apr_time_t) apr_time_now(void);
00085 
00087 typedef struct apr_time_exp_t apr_time_exp_t;
00088 
00094 struct apr_time_exp_t {
00096     apr_int32_t tm_usec;
00098     apr_int32_t tm_sec;
00100     apr_int32_t tm_min;
00102     apr_int32_t tm_hour;
00104     apr_int32_t tm_mday;
00106     apr_int32_t tm_mon;
00108     apr_int32_t tm_year;
00110     apr_int32_t tm_wday;
00112     apr_int32_t tm_yday;
00114     apr_int32_t tm_isdst;
00116     apr_int32_t tm_gmtoff;
00117 };
00118 
00124 APR_DECLARE(apr_status_t) apr_time_ansi_put(apr_time_t *result, 
00125                                                     time_t input);
00126 
00134 APR_DECLARE(apr_status_t) apr_time_exp_tz(apr_time_exp_t *result,
00135                                           apr_time_t input,
00136                                           apr_int32_t offs);
00137 
00139 APR_DECLARE(apr_status_t) apr_explode_time(apr_time_exp_t *result,
00140                                            apr_time_t input,
00141                                            apr_int32_t offs);
00142 
00148 APR_DECLARE(apr_status_t) apr_time_exp_gmt(apr_time_exp_t *result, 
00149                                            apr_time_t input);
00150 
00156 APR_DECLARE(apr_status_t) apr_time_exp_lt(apr_time_exp_t *result, 
00157                                           apr_time_t input);
00158 
00160 APR_DECLARE(apr_status_t) apr_explode_localtime(apr_time_exp_t *result, 
00161                                                 apr_time_t input);
00162 
00169 APR_DECLARE(apr_status_t) apr_time_exp_get(apr_time_t *result, 
00170                                            apr_time_exp_t *input);
00171 
00178 APR_DECLARE(apr_status_t) apr_time_exp_gmt_get(apr_time_t *result, 
00179                                                apr_time_exp_t *input);
00180 
00182 APR_DECLARE(apr_status_t) apr_implode_gmt(apr_time_t *result, 
00183                                           apr_time_exp_t *input);
00184 
00190 APR_DECLARE(void) apr_sleep(apr_interval_time_t t);
00191 
00193 #define APR_RFC822_DATE_LEN (30)
00194 
00202 APR_DECLARE(apr_status_t) apr_rfc822_date(char *date_str, apr_time_t t);
00203 
00205 #define APR_CTIME_LEN (25)
00206 
00216 APR_DECLARE(apr_status_t) apr_ctime(char *date_str, apr_time_t t);
00217 
00226 APR_DECLARE(apr_status_t) apr_strftime(char *s, apr_size_t *retsize, 
00227                                        apr_size_t max, const char *format, 
00228                                        apr_time_exp_t *tm);
00229 
00236 APR_DECLARE(void) apr_time_clock_hires(apr_pool_t *p);
00237 
00240 #ifdef __cplusplus
00241 }
00242 #endif
00243 
00244 #endif  /* ! APR_TIME_H */

Generated on Wed Dec 8 10:14:03 2004 for Apache Portable Runtime by doxygen 1.3.6