show ping response lines and stats lines

This commit is contained in:
2025-05-02 01:17:18 +02:00
parent b4afb26076
commit e3a2901370
8 changed files with 233 additions and 117 deletions

View File

@ -6,7 +6,7 @@
/* By: tomoron <tomoron@student.42angouleme.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/04/26 17:03:11 by tomoron #+# #+# */
/* Updated: 2025/04/26 17:08:08 by tomoron ### ########.fr */
/* Updated: 2025/05/02 01:07:37 by tomoron ### ########.fr */
/* */
/* ************************************************************************** */
#include "includes/ft_ping.h"
@ -37,9 +37,19 @@ void free_hosts(t_host_list *list)
while(list)
{
printf("free : %s\n", list->host);
tmp = list->next;
free(list);
list = tmp;
}
}
double timediff(struct timeval *from)
{
struct timeval now;
float diff;
gettimeofday(&now, 0);
diff = ((double)now.tv_sec - from->tv_sec);
diff += (((double)now.tv_usec / 1000000) - ((double)from->tv_usec / 1000000));
return(diff);
}