From da27a0580f129c4ff8b969d2c2d67c0dd71f741d Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Wed, 12 Oct 2016 15:23:59 +0200 Subject: calculate date/time string only when needed --- pacredir.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/pacredir.c b/pacredir.c index 14b2073..b704f1c 100644 --- a/pacredir.c +++ b/pacredir.c @@ -451,14 +451,15 @@ static int ahc_echo(void * cls, request = requests[i]; - /* write the time to buffer ctime, then strip the line break */ - ctime_r(&request->last_modified, ctime); - ctime[strlen(ctime) - 1] = '\0'; - if (request->http_code == MHD_HTTP_OK) { - if (verbose > 0) + if (verbose > 0) { + /* write the time to buffer ctime, then strip the line break */ + ctime_r(&request->last_modified, ctime); + ctime[strlen(ctime) - 1] = '\0'; + write_log(stdout, "Found: %s (%f sec, modified: %s)\n", request->url, request->time_total, ctime); + } } else if (verbose > 0 && request->http_code > 0) { if (verbose > 0) write_log(stderr, "Received HTTP status code %d for %s\n", -- cgit v1.2.3-70-g09d2