1
0
mirror of https://github.com/fumiama/simple-dict.git synced 2026-06-13 15:01:00 +08:00

add timestamp in log

This commit is contained in:
源文雨
2022-05-07 23:03:40 +08:00
parent 9514fe9dec
commit a78b8225db

View File

@@ -720,7 +720,8 @@ static void accept_client(int fd) {
char str[INET_ADDRSTRLEN]; // 16 char str[INET_ADDRSTRLEN]; // 16
inet_ntop(AF_INET, &in, str, sizeof(str)); inet_ntop(AF_INET, &in, str, sizeof(str));
#endif #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]; thread_timer_t* timer = &timers[p];
timer->accept_fd = accept_fd; timer->accept_fd = accept_fd;
timer->index = p; timer->index = p;