/* Licensed to the Apache Software Foundation (ASF) under one or more *contributorlicenseagreements.SeetheNOTICEfiledistributedwith *thisworkforadditionalinformationregardingcopyrightownership. *TheASFlicensesthisfiletoYouundertheApacheLicense,Version2.0 *(the"License");youmaynotusethisfileexceptincompliancewith *theLicense.YoumayobtainacopyoftheLicenseat * *http://www.apache.org/licenses/LICENSE-2.0 * *Unlessrequiredbyapplicablelaworagreedtoinwriting,software *distributedundertheLicenseisdistributedonan"ASIS"BASIS, *WITHOUTWARRANTIESORCONDITIONSOFANYKIND,eitherexpressorimplied. *SeetheLicenseforthespecificlanguagegoverningpermissionsand *limitationsundertheLicense.
*/
#include"util_time.h"
/* Number of characters needed to format the microsecond part of a timestamp. *Microsecondshave6digitsplusoneseparatorcharactermakes7.
* */ #define AP_CTIME_USEC_LENGTH 7
/* Length of ISO 8601 date/time (including trailing '\0') */ #define AP_CTIME_COMPACT_LEN 20
/* Length of timezone offset from GMT ([+-]hhmm) plus leading space */ #define AP_CTIME_GMTOFF_LEN 6
/* Cache for exploded values of recent timestamps
*/
struct exploded_time_cache_element {
apr_int64_t t;
apr_time_exp_t xt;
apr_int64_t t_validate; /* please see comments in cached_explode() */
};
/* the "+ 1" is for the current second: */ #define TIME_CACHE_SIZE (AP_TIME_RECENT_THRESHOLD + 1)
/* Note that AP_TIME_RECENT_THRESHOLD is defined to *beapoweroftwominusoneinutil_time.h,sothat *wecanreplaceamodulooperationwithabitwiseAND *whenhashingitemsintoacacheofsize *AP_TIME_RECENT_THRESHOLD+1
*/ #define TIME_CACHE_MASK (AP_TIME_RECENT_THRESHOLD)
AP_DECLARE(apr_status_t) ap_recent_ctime(char *date_str, apr_time_t t)
{ int len = APR_CTIME_LEN; return ap_recent_ctime_ex(date_str, t, AP_CTIME_OPTION_NONE, &len);
}
AP_DECLARE(apr_status_t) ap_recent_ctime_ex(char *date_str, apr_time_t t, int option, int *len)
{ /* ### This code is a clone of apr_ctime(), except that it *usesap_explode_recent_localtime()insteadofapr_time_exp_lt().
*/
apr_time_exp_t xt; constchar *s; int real_year; int needed;
/* Calculate the needed buffer length */ if (option & AP_CTIME_OPTION_COMPACT)
needed = AP_CTIME_COMPACT_LEN; else
needed = APR_CTIME_LEN;
if (option & AP_CTIME_OPTION_USEC) {
needed += AP_CTIME_USEC_LENGTH;
}
if (option & AP_CTIME_OPTION_GMTOFF) {
needed += AP_CTIME_GMTOFF_LEN;
}
/* example without options: "Wed Jun 30 21:49:08 1993" */ /* example for compact format: "1993-06-30 21:49:08" */ /* example for compact+usec+gmtoff format: *"1993-06-3022:49:08.123456+0100"
*/
AP_DECLARE(apr_status_t) ap_recent_rfc822_date(char *date_str, apr_time_t t)
{ /* ### This code is a clone of apr_rfc822_date(), except that it *usesap_explode_recent_gmt()insteadofapr_time_exp_gmt().
*/
apr_time_exp_t xt; constchar *s; int real_year;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.