1 /* Copyright 2001-2004 The Apache Software Foundation
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
7 * http://www.apache.org/licenses/LICENSE-2.0
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
16 #ifndef APACHE_UTIL_TIME_H
17 #define APACHE_UTIL_TIME_H
28 * @package Apache date-time handling functions
31 /* Maximum delta from the current time, in seconds, for a past time
32 * to qualify as "recent" for use in the ap_explode_recent_*() functions:
33 * (Must be a power of two minus one!)
35 #define AP_TIME_RECENT_THRESHOLD 15
38 * convert a recent time to its human readable components in local timezone
39 * @param tm the exploded time
40 * @param t the time to explode: MUST be within the last
41 * AP_TIME_RECENT_THRESHOLD seconds
42 * @note This is a faster alternative to apr_time_exp_lt that uses
43 * a cache of pre-exploded time structures. It is useful for things
44 * that need to explode the current time multiple times per second,
46 * @return APR_SUCCESS iff successful
48 AP_DECLARE(apr_status_t) ap_explode_recent_localtime(apr_time_exp_t *tm,
52 * convert a recent time to its human readable components in GMT timezone
53 * @param tm the exploded time
54 * @param t the time to explode: MUST be within the last
55 * AP_TIME_RECENT_THRESHOLD seconds
56 * @note This is a faster alternative to apr_time_exp_gmt that uses
57 * a cache of pre-exploded time structures. It is useful for things
58 * that need to explode the current time multiple times per second,
60 * @return APR_SUCCESS iff successful
62 AP_DECLARE(apr_status_t) ap_explode_recent_gmt(apr_time_exp_t *tm,
67 * format a recent timestamp in the ctime() format.
68 * @param date_str String to write to.
69 * @param t the time to convert
71 AP_DECLARE(apr_status_t) ap_recent_ctime(char *date_str, apr_time_t t);
74 * format a recent timestamp in the RFC822 format
75 * @param date_str String to write to (must have length >= APR_RFC822_DATE_LEN)
76 * @param t the time to convert
78 AP_DECLARE(apr_status_t) ap_recent_rfc822_date(char *date_str, apr_time_t t);
84 #endif /* !APACHE_UTIL_TIME_H */