Improve LOGS and time

This commit is contained in:
Kamil Trzcinski
2022-04-05 10:55:28 +02:00
parent 3f9d235505
commit cdcac155f6
6 changed files with 36 additions and 27 deletions

View File

@ -74,3 +74,17 @@ unsigned fourcc_to_stride(unsigned width, unsigned format)
E_LOG_PERROR(NULL, "Unknown format: %s", fourcc_to_string(format).buf);
}
}
uint64_t get_monotonic_time_us(struct timespec *ts, struct timeval *tv)
{
struct timespec now;
clock_gettime(CLOCK_MONOTONIC, &now);
if (ts) {
*ts = now;
}
if (tv) {
tv->tv_sec = now.tv_sec;
tv->tv_usec = now.tv_nsec / 1000;
}
return now.tv_sec * 1000000LL + now.tv_nsec / 1000;
}