00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
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
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
00144 APR_DECLARE(apr_status_t) apr_time_exp_gmt(apr_time_exp_t *result,
00145 apr_time_t input);
00146
00152 APR_DECLARE(apr_status_t) apr_time_exp_lt(apr_time_exp_t *result,
00153 apr_time_t input);
00154
00161 APR_DECLARE(apr_status_t) apr_time_exp_get(apr_time_t *result,
00162 apr_time_exp_t *input);
00163
00170 APR_DECLARE(apr_status_t) apr_time_exp_gmt_get(apr_time_t *result,
00171 apr_time_exp_t *input);
00172
00178 APR_DECLARE(void) apr_sleep(apr_interval_time_t t);
00179
00181 #define APR_RFC822_DATE_LEN (30)
00182
00190 APR_DECLARE(apr_status_t) apr_rfc822_date(char *date_str, apr_time_t t);
00191
00193 #define APR_CTIME_LEN (25)
00194
00204 APR_DECLARE(apr_status_t) apr_ctime(char *date_str, apr_time_t t);
00205
00214 APR_DECLARE(apr_status_t) apr_strftime(char *s, apr_size_t *retsize,
00215 apr_size_t max, const char *format,
00216 apr_time_exp_t *tm);
00217
00224 APR_DECLARE(void) apr_time_clock_hires(apr_pool_t *p);
00225
00228 #ifdef __cplusplus
00229 }
00230 #endif
00231
00232 #endif