apr_time.h

Go to the documentation of this file.
00001 /* Licensed to the Apache Software Foundation (ASF) under one or more
00002  * contributor license agreements.  See the NOTICE file distributed with
00003  * this work for additional information regarding copyright ownership.
00004  * The ASF licenses this file to You under the Apache License, Version 2.0
00005  * (the "License"); you may not use this file except in compliance with
00006  * the License.  You may obtain a copy of the License at
00007  *
00008  *     http://www.apache.org/licenses/LICENSE-2.0
00009  *
00010  * Unless required by applicable law or agreed to in writing, software
00011  * distributed under the License is distributed on an "AS IS" BASIS,
00012  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013  * See the License for the specific language governing permissions and
00014  * limitations under the License.
00015  */
00016 
00017 #ifndef APR_TIME_H
00018 #define APR_TIME_H
00019 
00025 #include "apr.h"
00026 #include "apr_pools.h"
00027 #include "apr_errno.h"
00028 
00029 #ifdef __cplusplus
00030 extern "C" {
00031 #endif /* __cplusplus */
00032 
00040 APR_DECLARE_DATA extern const char apr_month_snames[12][4];
00042 APR_DECLARE_DATA extern const char apr_day_snames[7][4];
00043 
00044 
00046 typedef apr_int64_t apr_time_t;
00047 
00048 
00050 #define APR_TIME_C(val) APR_INT64_C(val)
00051 
00053 #define APR_TIME_T_FMT APR_INT64_T_FMT
00054 
00056 typedef apr_int64_t apr_interval_time_t;
00058 typedef apr_int32_t apr_short_interval_time_t;
00059 
00061 #define APR_USEC_PER_SEC APR_TIME_C(1000000)
00062 
00064 #define apr_time_sec(time) ((time) / APR_USEC_PER_SEC)
00065 
00067 #define apr_time_usec(time) ((time) % APR_USEC_PER_SEC)
00068 
00070 #define apr_time_msec(time) (((time) / 1000) % 1000)
00071 
00073 #define apr_time_as_msec(time) ((time) / 1000)
00074 
00076 #define apr_time_from_sec(sec) ((apr_time_t)(sec) * APR_USEC_PER_SEC)
00077 
00079 #define apr_time_make(sec, usec) ((apr_time_t)(sec) * APR_USEC_PER_SEC \
00080                                 + (apr_time_t)(usec))
00081 
00085 APR_DECLARE(apr_time_t) apr_time_now(void);
00086 
00088 typedef struct apr_time_exp_t apr_time_exp_t;
00089 
00095 struct apr_time_exp_t {
00097     apr_int32_t tm_usec;
00099     apr_int32_t tm_sec;
00101     apr_int32_t tm_min;
00103     apr_int32_t tm_hour;
00105     apr_int32_t tm_mday;
00107     apr_int32_t tm_mon;
00109     apr_int32_t tm_year;
00111     apr_int32_t tm_wday;
00113     apr_int32_t tm_yday;
00115     apr_int32_t tm_isdst;
00117     apr_int32_t tm_gmtoff;
00118 };
00119 
00125 APR_DECLARE(apr_status_t) apr_time_ansi_put(apr_time_t *result, 
00126                                                     time_t input);
00127 
00135 APR_DECLARE(apr_status_t) apr_time_exp_tz(apr_time_exp_t *result,
00136                                           apr_time_t input,
00137                                           apr_int32_t offs);
00138 
00140 APR_DECLARE(apr_status_t) apr_explode_time(apr_time_exp_t *result,
00141                                            apr_time_t input,
00142                                            apr_int32_t offs);
00143 
00149 APR_DECLARE(apr_status_t) apr_time_exp_gmt(apr_time_exp_t *result, 
00150                                            apr_time_t input);
00151 
00157 APR_DECLARE(apr_status_t) apr_time_exp_lt(apr_time_exp_t *result, 
00158                                           apr_time_t input);
00159 
00161 APR_DECLARE(apr_status_t) apr_explode_localtime(apr_time_exp_t *result, 
00162                                                 apr_time_t input);
00163 
00170 APR_DECLARE(apr_status_t) apr_time_exp_get(apr_time_t *result, 
00171                                            apr_time_exp_t *input);
00172 
00179 APR_DECLARE(apr_status_t) apr_time_exp_gmt_get(apr_time_t *result, 
00180                                                apr_time_exp_t *input);
00181 
00183 APR_DECLARE(apr_status_t) apr_implode_gmt(apr_time_t *result, 
00184                                           apr_time_exp_t *input);
00185 
00191 APR_DECLARE(void) apr_sleep(apr_interval_time_t t);
00192 
00194 #define APR_RFC822_DATE_LEN (30)
00195 
00203 APR_DECLARE(apr_status_t) apr_rfc822_date(char *date_str, apr_time_t t);
00204 
00206 #define APR_CTIME_LEN (25)
00207 
00217 APR_DECLARE(apr_status_t) apr_ctime(char *date_str, apr_time_t t);
00218 
00227 APR_DECLARE(apr_status_t) apr_strftime(char *s, apr_size_t *retsize, 
00228                                        apr_size_t max, const char *format, 
00229                                        apr_time_exp_t *tm);
00230 
00237 APR_DECLARE(void) apr_time_clock_hires(apr_pool_t *p);
00238 
00241 #ifdef __cplusplus
00242 }
00243 #endif
00244 
00245 #endif  /* ! APR_TIME_H */

Generated on Mon Nov 26 11:47:26 2007 for Apache Portable Runtime by  doxygen 1.5.2