1
0
mirror of https://gitlab.xiph.org/xiph/icecast-common.git synced 2024-12-04 14:46:31 -05:00

Update: Use clock_gettime(CLOCK_MONOTONIC, ...) if available

This commit is contained in:
Philipp Schafft 2019-08-21 16:00:25 +00:00
parent a119a6d4c9
commit 1d55a731ff

View File

@ -66,7 +66,13 @@
*/
uint64_t igloo_timing_get_time(void)
{
#ifdef HAVE_GETTIMEOFDAY
#ifdef CLOCK_MONOTONIC
struct timespec ts = {0, 0};
clock_gettime(CLOCK_MONOTONIC, &ts);
return (uint64_t)(ts.tv_sec) * 1000 + (uint64_t)(ts.tv_nsec) / 1000000;
#elif HAVE_GETTIMEOFDAY
struct timeval mtv;
gettimeofday(&mtv, NULL);