summaryrefslogtreecommitdiff
path: root/httpd.c
diff options
context:
space:
mode:
authordefault <nobody@localhost>2023-05-08 09:34:27 +0200
committerdefault <nobody@localhost>2023-05-08 09:34:27 +0200
commit920ff76297006968603898e8c60dafd9346dad4b (patch)
treeb7eafa92eae4d2ded367102ebf269926ef676489 /httpd.c
parent7b349dd001f6642a216491d57e945fa3f0b69fe7 (diff)
Print the total running time at httpd stop.
Diffstat (limited to 'httpd.c')
-rw-r--r--httpd.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/httpd.c b/httpd.c
index e8223f5..a86142d 100644
--- a/httpd.c
+++ b/httpd.c
@@ -8,6 +8,7 @@
#include "xs_socket.h"
#include "xs_httpd.h"
#include "xs_mime.h"
+#include "xs_time.h"
#include "snac.h"
@@ -480,6 +481,7 @@ void httpd(void)
pthread_t threads[MAX_THREADS] = {0};
int n_threads = 0;
int n;
+ time_t start_time = time(NULL);
address = xs_dict_get(srv_config, "address");
port = xs_number_get(xs_dict_get(srv_config, "port"));
@@ -566,5 +568,7 @@ void httpd(void)
sem_close(job_sem);
- srv_log(xs_fmt("httpd stop %s:%d", address, port));
+ xs *uptime = xs_str_time_diff(time(NULL) - start_time);
+
+ srv_log(xs_fmt("httpd stop %s:%d (run time: %s)", address, port, uptime));
}