mirror of
https://github.com/n5ac/smartsdr-dsp.git
synced 2025-12-06 03:01:59 +01:00
msSince() function added to utils
This commit is contained in:
parent
a3c4fedced
commit
f64b60a1c6
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -40,6 +40,7 @@ void output(const char *fmt,...);
|
|||
void tsAdd(struct timespec* time1, struct timespec time2);
|
||||
float tsfSubtract(struct timespec time1, struct timespec time2);
|
||||
uint32 usSince(struct timespec time);
|
||||
uint32 msSince(struct timespec time);
|
||||
uint32 getIP(char* text);
|
||||
void lock_malloc_init(void);
|
||||
void* safe_malloc(size_t size);
|
||||
|
|
|
|||
Loading…
Reference in a new issue