summaryrefslogtreecommitdiffstats
path: root/pacredir.c
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2016-10-12 15:23:59 +0200
committerGravatar Christian Hesse <mail@eworm.de>2016-10-12 15:23:59 +0200
commitda27a0580f129c4ff8b969d2c2d67c0dd71f741d (patch)
tree929166c1a7a60a88304171d328b7affd3d3b5804 /pacredir.c
parenteb23dfb9712eef0b26762baabe578f8da89bf80f (diff)
downloadpacredir-da27a0580f129c4ff8b969d2c2d67c0dd71f741d.tar.gz
pacredir-da27a0580f129c4ff8b969d2c2d67c0dd71f741d.tar.zst
calculate date/time string only when needed
Diffstat (limited to 'pacredir.c')
-rw-r--r--pacredir.c11
1 files 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",