msSince() function added to utils

This commit is contained in:
Hayley 2019-06-19 15:54:47 -05:00 committed by Ed Gonzalez
parent 1299c69199
commit 6880b87d01
2 changed files with 10 additions and 0 deletions

View file

@ -86,6 +86,7 @@ float tsfSubtract(struct timespec time1, struct timespec time2)
return result;
}
//! get time since a certain time in microseconds
uint32 usSince(struct timespec time)
{
@ -95,6 +96,14 @@ uint32 usSince(struct timespec time)
return diff_us;
}
uint32 msSince(struct timespec time)
{
struct timespec delay;
clock_gettime(CLOCK_MONOTONIC, &delay);
uint32 diff_ms = (uint32)(tsSubtract(delay, time));
return diff_ms;
}
uint32 getIP(char* text)
{
uint32 ip;