Commit b0b0226b authored by rna's avatar rna

Merge branch 'develop' into feature/congestionControl

parents 70070657 038a34c1
Pipeline #2508 failed with stages
in 1 minute and 12 seconds
......@@ -44,18 +44,6 @@ static inline prrtPacketLength_t deliver_packet(const PrrtSocket *s, void *buffe
return len;
}
struct timespec abstime_from_now(prrtTimedelta_t wait_time) {
struct timespec now;
clock_gettime(CLOCK_REALTIME, &now);
struct timespec deadline;
prrtTimedelta_t diff_s = wait_time / 1000000;
prrtTimedelta_t diff_ns = (wait_time % 1000000) * 1000;
deadline.tv_sec = diff_s + now.tv_sec;
deadline.tv_nsec = diff_ns + now.tv_nsec;
return deadline;
}
PrrtSocket *PrrtSocket_create(prrtByteCount_t mtu, prrtTimedelta_t target_delay_us) {
assert(sizeof(float) == 4);
PrrtSocket *s = (PrrtSocket *) calloc(1, sizeof(PrrtSocket));
......
......@@ -6,6 +6,7 @@ add_library(UTIL ../defines.h
bptree.c bptree.h
bitmap.c bitmap.h
mpsc_queue.c mpsc_queue.h
time.c time.h
windowedFilter.c windowedFilter.h)
set_property(TARGET UTIL PROPERTY C_STANDARD 99)
target_link_libraries(UTIL ${M_LIB})
#include <time.h>
#include <stdint.h>
#include "time.h"
long long timedelta(struct timespec *t1, struct timespec *t2) {
long long delta = t1->tv_sec - t2->tv_sec;
delta *= 1000000000;
delta += t1->tv_nsec - t2->tv_nsec;
return delta;
}
struct timespec abstime_from_now(uint32_t wait_time) {
struct timespec now;
clock_gettime(CLOCK_REALTIME, &now);
struct timespec deadline;
uint32_t diff_s = wait_time / 1000000;
uint32_t diff_ns = (wait_time % 1000000) * 1000;
deadline.tv_sec = diff_s + now.tv_sec;
deadline.tv_nsec = diff_ns + now.tv_nsec;
return deadline;
}
#ifndef PRRT_TIME_H
#define PRRT_TIME_H
long long timedelta(struct timespec *t1, struct timespec *t2);
struct timespec abstime_from_now(uint32_t wait_time);
#endif //PRRT_TIME_H
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment