🏗️」 wip: wut

This commit is contained in:
2025-08-15 18:19:22 +02:00
parent 4c6fc1ecb1
commit 057fb25cf7
3 changed files with 48 additions and 4 deletions

View File

@ -1,8 +1,8 @@
#include <ping.h>
#include <unistd.h>
#include <stdlib.h>
#include <unistd.h>
void append_time(double time) {
void append_time(double time) {
if (times == NULL) {
times = malloc(sizeof(double));
times[0] = time;
@ -12,3 +12,34 @@ void append_time(double time) {
}
}
double get_max_rtt(void) {
double max = 0;
for (int i = 0; i < rx_count; i++) {
if (times[i] > max)
max = times[i];
}
return max;
}
double get_min_rtt(void) {
double min = 0;
for (int i = 0; i < rx_count; i++) {
if (times[i] < min)
min = times[i];
}
return min;
}
double get_avg_rtt(void) {
double avg = 0;
for (int i = 0; i < rx_count; i++) {
avg += times[i];
}
avg = avg / rx_count;
return avg;
}
double get_stddev_rtt(void) {
double stddev = 0;
return stddev;
}