Files
runwhenidle/time_utils.c
Konstantin Pereiaslov 592c4e239f Account for the time it took to pause the command when calculating how long to sleep for.
Possibly unnecessary as this always seems to be 0 on my machine.
2023-05-20 00:40:08 -05:00

7 lines
278 B
C

#include "time_utils.h"
long long get_elapsed_time_ms(struct timespec start, struct timespec end) {
long long start_ms = start.tv_sec * 1000LL + start.tv_nsec / 1000000LL;
long long end_ms = end.tv_sec * 1000LL + end.tv_nsec / 1000000LL;
return end_ms - start_ms;
}