From 01fa50f4a7d255f0c3ebe38e2a22eae670c8b9be Mon Sep 17 00:00:00 2001 From: andersb Date: Wed, 13 Sep 2006 21:26:01 +0000 Subject: [PATCH] Fixed timestamp so thats it's correct. PHK added a new variable to ReqEnd that contains a correct endtime. git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@980 d4fa192b-c00b-0410-8231-f00ffab90ce4 --- varnish-cache/bin/varnishncsa/varnishncsa.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/varnish-cache/bin/varnishncsa/varnishncsa.c b/varnish-cache/bin/varnishncsa/varnishncsa.c index fccc6362..6787c32a 100644 --- a/varnish-cache/bin/varnishncsa/varnishncsa.c +++ b/varnish-cache/bin/varnishncsa/varnishncsa.c @@ -82,7 +82,7 @@ clean_order(void) } } -static struct tm *make_timestring(char *tmpPtra){ +static struct tm *make_timestruct(char *tmpPtra){ char *tmpPtrb; int timesec = 0; time_t req_time; // Timeobject used for making the requesttime. @@ -92,17 +92,19 @@ static struct tm *make_timestring(char *tmpPtra){ temp_time[0] = '\0'; for ( tmpPtrb = strtok(tmpPtra," "); tmpPtrb != NULL; tmpPtrb = strtok(NULL, " ")){ - if (i == 1){ + if (i == 2){ // We have the right time //printf("Time: %s\n", tmpPtrb); tmpPtra = tmpPtrb; + strncpy(temp_time, tmpPtra, 10); + temp_time[11] = '\0'; } //printf("ReqServTime number %d: %s\n", i, tmpPtrb); i++; } - strncpy(temp_time, tmpPtra, 10); - temp_time[10] = '\0'; + + //strncpy(temp_time, tmpPtra, 20); //printf("inten: %s\n",temp_time); timesec = atoi(temp_time); req_time = timesec; @@ -229,7 +231,7 @@ extended_log_format(unsigned char *p) // We use ReqServTime to find how the time the request was delivered // also to define that a request is finished. tmpPtra = strdup(p + 4); - ll[u].logline_time = make_timestring(tmpPtra); + ll[u].logline_time = make_timestruct(tmpPtra); free(tmpPtra); ll[u].df_rfini = 1; //printf("ReqServTime %s\n", temp_time); @@ -301,7 +303,7 @@ extended_log_format(unsigned char *p) char temp_time[27]; // Where we store the string we take from the log // make temp_time - strftime (temp_time, 28, "[%d/%b/%Y:%X %z] ", ll[u].logline_time); + strftime (temp_time, 29, "[%d/%b/%Y:%X %z] ", ll[u].logline_time); if (ll[u].df_h[0] == '\0' || ll[u].bogus_req){ ll[u].bogus_req = 0; -- 2.39.5