diff options
author | Rainer Jung <rjung@apache.org> | 2010-06-07 14:30:05 +0200 |
---|---|---|
committer | Rainer Jung <rjung@apache.org> | 2010-06-07 14:30:05 +0200 |
commit | 3a00cf67f3709b198370bb159f3cc05863160fb3 (patch) | |
tree | 718d4e8550ffc04626e564e29c42b7efa718ef41 /include/util_time.h | |
parent | Add process id and thread id (if APR has thread support) (diff) | |
download | apache2-3a00cf67f3709b198370bb159f3cc05863160fb3.tar.xz apache2-3a00cf67f3709b198370bb159f3cc05863160fb3.zip |
Add microsecond timestamps to the error log.
The new function ap_recent_ctime_ex allows for
optional formatting hints. It checks the provided buffer
length and returns the number of consumed bytes. This is necessary,
because when using options, the length of the formatted time string
is no longer constant.
The only option implemented currently is the addition of microsecond
fractions to the timestamp.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@952203 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'include/util_time.h')
-rw-r--r-- | include/util_time.h | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/include/util_time.h b/include/util_time.h index c99602da94..16706cff86 100644 --- a/include/util_time.h +++ b/include/util_time.h @@ -40,6 +40,13 @@ extern "C" { */ #define AP_TIME_RECENT_THRESHOLD 15 +/* Options for ap_recent_ctime_ex */ +/* No extension */ +#define AP_CTIME_OPTION_NONE 0x0 +/* Add sub second timestamps with micro second resolution */ +#define AP_CTIME_OPTION_USEC 0x1 + + /** * convert a recent time to its human readable components in local timezone * @param tm the exploded time @@ -73,9 +80,26 @@ AP_DECLARE(apr_status_t) ap_explode_recent_gmt(apr_time_exp_t *tm, * format a recent timestamp in the ctime() format. * @param date_str String to write to. * @param t the time to convert + * @note Consider using ap_recent_ctime_ex instead. + * @return APR_SUCCESS iff successful */ AP_DECLARE(apr_status_t) ap_recent_ctime(char *date_str, apr_time_t t); + +/** + * format a recent timestamp in an extended ctime() format. + * @param date_str String to write to. + * @param t the time to convert + * @param option Additional formatting options (AP_CTIME_OPTION_*). + * @param len Pointer to an int containing the length of the provided buffer. + * On successful return it contains the number of bytes written to the + * buffer. + * @return APR_SUCCESS iff successful, APR_ENOMEM if buffer was to short. + */ +AP_DECLARE(apr_status_t) ap_recent_ctime_ex(char *date_str, apr_time_t t, + int option, int *len); + + /** * format a recent timestamp in the RFC822 format * @param date_str String to write to (must have length >= APR_RFC822_DATE_LEN) |