b38846b15c8891c6dec44dcc4f96ca40721bf663rbb/* Licensed to the Apache Software Foundation (ASF) under one or more
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb * contributor license agreements. See the NOTICE file distributed with
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb * this work for additional information regarding copyright ownership.
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb * The ASF licenses this file to You under the Apache License, Version 2.0
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb * (the "License"); you may not use this file except in compliance with
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb * the License. You may obtain a copy of the License at
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb * Unless required by applicable law or agreed to in writing, software
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb * distributed under the License is distributed on an "AS IS" BASIS,
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb * See the License for the specific language governing permissions and
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb * limitations under the License.
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb * @brief Apache date-time handling functions
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb * @defgroup APACHE_CORE_TIME Date-time handling functions
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb * @ingroup APACHE_CORE
b38846b15c8891c6dec44dcc4f96ca40721bf663rbbextern "C" {
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb/* Maximum delta from the current time, in seconds, for a past time
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb * to qualify as "recent" for use in the ap_explode_recent_*() functions:
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb * (Must be a power of two minus one!)
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb/* Options for ap_recent_ctime_ex */
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb/* No extension */
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb/* Add sub second timestamps with micro second resolution */
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb/* Use more compact ISO 8601 format */
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb * convert a recent time to its human readable components in local timezone
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb * @param tm the exploded time
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb * @param t the time to explode: MUST be within the last
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb * AP_TIME_RECENT_THRESHOLD seconds
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb * @note This is a faster alternative to apr_time_exp_lt that uses
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb * a cache of pre-exploded time structures. It is useful for things
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb * that need to explode the current time multiple times per second,
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb * like loggers.
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb * @return APR_SUCCESS iff successful
b38846b15c8891c6dec44dcc4f96ca40721bf663rbbAP_DECLARE(apr_status_t) ap_explode_recent_localtime(apr_time_exp_t *tm,
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb * convert a recent time to its human readable components in GMT timezone
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb * @param tm the exploded time
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb * @param t the time to explode: MUST be within the last
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb * AP_TIME_RECENT_THRESHOLD seconds
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb * @note This is a faster alternative to apr_time_exp_gmt that uses
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb * a cache of pre-exploded time structures. It is useful for things
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb * that need to explode the current time multiple times per second,
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb * like loggers.
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb * @return APR_SUCCESS iff successful
b38846b15c8891c6dec44dcc4f96ca40721bf663rbbAP_DECLARE(apr_status_t) ap_explode_recent_gmt(apr_time_exp_t *tm,
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb * format a recent timestamp in the ctime() format.
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb * @param date_str String to write to.
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb * @param t the time to convert
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb * @note Consider using ap_recent_ctime_ex instead.
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb * @return APR_SUCCESS iff successful
b38846b15c8891c6dec44dcc4f96ca40721bf663rbbAP_DECLARE(apr_status_t) ap_recent_ctime(char *date_str, apr_time_t t);
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb * format a recent timestamp in an extended ctime() format.
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb * @param date_str String to write to.
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb * @param t the time to convert
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb * @param option Additional formatting options (AP_CTIME_OPTION_*).
a2a0abd88b19e042a3eb2a9fa1702c25ad51303dwrowe * @param len Pointer to an int containing the length of the provided buffer.
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb * On successful return it contains the number of bytes written to the
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb * @return APR_SUCCESS iff successful, APR_ENOMEM if buffer was to short.
b38846b15c8891c6dec44dcc4f96ca40721bf663rbbAP_DECLARE(apr_status_t) ap_recent_ctime_ex(char *date_str, apr_time_t t,
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb * format a recent timestamp in the RFC822 format
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb * @param date_str String to write to (must have length >= APR_RFC822_DATE_LEN)
a2a0abd88b19e042a3eb2a9fa1702c25ad51303dwrowe * @param t the time to convert
b38846b15c8891c6dec44dcc4f96ca40721bf663rbbAP_DECLARE(apr_status_t) ap_recent_rfc822_date(char *date_str, apr_time_t t);
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb * Force an unset TZ to UTC
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb * @param p the pool to use
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb#endif /* !APACHE_UTIL_TIME_H */