From a78b8225db116db63e3be61d955ecd00fc76004f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=BA=90=E6=96=87=E9=9B=A8?= <41315874+fumiama@users.noreply.github.com> Date: Sat, 7 May 2022 23:03:40 +0800 Subject: [PATCH] add timestamp in log --- server.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/server.c b/server.c index 98078f3..252a8b5 100644 --- a/server.c +++ b/server.c @@ -720,7 +720,8 @@ static void accept_client(int fd) { char str[INET_ADDRSTRLEN]; // 16 inet_ntop(AF_INET, &in, str, sizeof(str)); #endif - printf("\nAccept client %s:%u at slot No.%d\n", str, port, p); + time_t t = time(NULL); + printf("\n> %sAccept client %s:%u at slot No.%d\n", ctime(&t), str, port, p); thread_timer_t* timer = &timers[p]; timer->accept_fd = accept_fd; timer->index = p;