summaryrefslogtreecommitdiffstats
path: root/functions13.h
diff options
context:
space:
mode:
authorGravatar Edward Rudd 2004-01-20 16:27:35 +0000
committerGravatar Edward Rudd 2004-01-20 16:27:35 +0000
commit40f0c8fe04858acd724d6221dbf8a357259e5d6b (patch)
treec3effb1a7fa38e47152417830ab1c7480bddf703 /functions13.h
parent417afc1671669fc9ba79410546c6ddfe242f2f4a (diff)
split out version specific code
code compiles under apache 1.3 and 2.0 updated apache m4 script to detect both verions (two minumums) defaulted install to not activate module in configuration file (use make activate)
Diffstat (limited to 'functions13.h')
-rw-r--r--functions13.h38
1 files changed, 38 insertions, 0 deletions
diff --git a/functions13.h b/functions13.h
new file mode 100644
index 0000000..bff37f2
--- /dev/null
+++ b/functions13.h
@@ -0,0 +1,38 @@
1static const char *extract_request_time(request_rec *r, char *a)
2{
3 int timz;
4 struct tm *t;
5 char tstr[MAX_STRING_LEN];
6
7 t = ap_get_gmtoff(&timz);
8
9 if (a && *a) { /* Custom format */
10 strftime(tstr, MAX_STRING_LEN, a, t);
11 } else { /* CLF format */
12 char sign = (timz < 0 ? '-' : '+');
13
14 if (timz < 0) {
15 timz = -timz;
16 }
17 strftime(tstr, MAX_STRING_LEN, "[%d/%b/%Y:%H:%M:%S ", t);
18 ap_snprintf(tstr + strlen(tstr), sizeof(tstr) - strlen(tstr), "%c%.2d%.2d]", sign, timz / 60, timz % 60);
19 }
20
21 return ap_pstrdup(r->pool, tstr);
22}
23
24static const char *extract_request_duration(request_rec *r, char *a)
25{
26 char duration[22]; /* Long enough for 2^64 */
27
28 ap_snprintf(duration, sizeof(duration), "%ld", (long) time(NULL) - r->request_time);
29 return ap_pstrdup(r->pool, duration);
30}
31
32static const char *extract_request_timestamp(request_rec *r, char *a)
33{
34 char tstr[32];
35
36 ap_snprintf(tstr, 32, "%ld", (long) time(NULL));
37 return ap_pstrdup(r->pool, tstr);
38}