Line # Revision Author
1 3 ahitrov@rambler.ru --- src/include/httpd.h.orig 2008-11-13 18:34:02.000000000 +0300
2 +++ src/include/httpd.h 2008-11-13 18:34:30.000000000 +0300
3 @@ -668,6 +668,7 @@
4 const char *hostname; /* Host, as set by full URI or Host: */
5
6 time_t request_time; /* When the request started */
7 + struct timeval request_utime; /* When the request started (usec) */
8
9 const char *status_line; /* Status line, if set by script */
10 int status; /* In any case */
11 --- src/main/http_main.c.orig 2008-11-13 18:32:38.000000000 +0300
12 +++ src/main/http_main.c 2008-11-13 18:33:06.000000000 +0300
13 @@ -1589,6 +1589,7 @@
14 /* in some cases we come here before setting the time */
15 if (log_req->request_time == 0) {
16 log_req->request_time = time(NULL);
17 + gettimeofday(&log_req->request_utime,NULL);
18 }
19 ap_log_transaction(log_req);
20 }
21 --- src/main/http_protocol.c.orig 2008-11-13 18:33:21.000000000 +0300
22 +++ src/main/http_protocol.c 2008-11-13 18:33:48.000000000 +0300
23 @@ -1007,6 +1007,7 @@
24 ap_bsetflag(conn->client, B_SAFEREAD, 0);
25
26 r->request_time = time(NULL);
27 + gettimeofday(&r->request_utime,NULL);
28 r->the_request = ap_pstrdup(r->pool, l);
29 r->method = ap_getword_white(r->pool, &ll);
30 uri = ap_getword_white(r->pool, &ll);
31 --- src/modules/standard/mod_log_config.c.orig 2008-11-13 18:27:40.000000000 +0300
32 +++ src/modules/standard/mod_log_config.c 2008-11-13 18:35:02.000000000 +0300
33 @@ -405,7 +405,13 @@
34
35 static const char *log_request_duration(request_rec *r, char *a)
36 {
37 - return ap_psprintf(r->pool, "%ld", time(NULL) - r->request_time);
38 + struct timeval tp;
39 + double tv1,tv2;
40 +
41 + tv1 = r->request_utime.tv_sec + (double)r->request_utime.tv_usec/1000000;
42 + gettimeofday(&tp, NULL);
43 + tv2 = tp.tv_sec + (double)tp.tv_usec/1000000;
44 + return ap_psprintf(r->pool, "%.3f", tv2 - tv1);
45 }
46
47 /* These next two routines use the canonical name:port so that log