upload http
[bottlenecks.git] / rubbos / app / httpd-2.0.64 / include / util_time.h
1 /* Licensed to the Apache Software Foundation (ASF) under one or more
2  * contributor license agreements.  See the NOTICE file distributed with
3  * this work for additional information regarding copyright ownership.
4  * The ASF licenses this file to You under the Apache License, Version 2.0
5  * (the "License"); you may not use this file except in compliance with
6  * the License.  You may obtain a copy of the License at
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 #ifndef APACHE_UTIL_TIME_H
18 #define APACHE_UTIL_TIME_H
19
20 #include "apr.h"
21 #include "apr_time.h"
22 #include "httpd.h"
23
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27
28 /**
29  * @package Apache date-time handling functions
30  */
31
32 /* Maximum delta from the current time, in seconds, for a past time
33  * to qualify as "recent" for use in the ap_explode_recent_*() functions:
34  * (Must be a power of two minus one!)
35  */
36 #define AP_TIME_RECENT_THRESHOLD 15
37
38 /**
39  * convert a recent time to its human readable components in local timezone
40  * @param tm the exploded time
41  * @param t the time to explode: MUST be within the last
42  *          AP_TIME_RECENT_THRESHOLD seconds
43  * @note This is a faster alternative to apr_explode_localtime that uses
44  *       a cache of pre-exploded time structures.  It is useful for things
45  *       that need to explode the current time multiple times per second,
46  *       like loggers.
47  * @return APR_SUCCESS iff successful
48  */
49 AP_DECLARE(apr_status_t) ap_explode_recent_localtime(apr_time_exp_t *tm,
50                                                      apr_time_t t);
51
52 /**
53  * convert a recent time to its human readable components in GMT timezone
54  * @param tm the exploded time
55  * @param t the time to explode: MUST be within the last
56  *          AP_TIME_RECENT_THRESHOLD seconds
57  * @note This is a faster alternative to apr_time_exp_gmt that uses
58  *       a cache of pre-exploded time structures.  It is useful for things
59  *       that need to explode the current time multiple times per second,
60  *       like loggers.
61  * @return APR_SUCCESS iff successful
62  */
63 AP_DECLARE(apr_status_t) ap_explode_recent_gmt(apr_time_exp_t *tm,
64                                                apr_time_t t);
65
66
67 /**
68  * format a recent timestamp in the ctime() format.
69  * @param date_str String to write to.
70  * @param t the time to convert 
71  */
72 AP_DECLARE(apr_status_t) ap_recent_ctime(char *date_str, apr_time_t t);
73
74 /**
75  * format a recent timestamp in the RFC822 format
76  * @param date_str String to write to (must have length >= APR_RFC822_DATE_LEN)
77  * @param t the time to convert 
78  */
79 AP_DECLARE(apr_status_t) ap_recent_rfc822_date(char *date_str, apr_time_t t);
80
81 #ifdef __cplusplus
82 }
83 #endif
84
85 #endif  /* !APACHE_UTIL_TIME_H */