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:
parent
a119a6d4c9
commit
1d55a731ff
@ -66,7 +66,13 @@
|
|||||||
*/
|
*/
|
||||||
uint64_t igloo_timing_get_time(void)
|
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;
|
struct timeval mtv;
|
||||||
|
|
||||||
gettimeofday(&mtv, NULL);
|
gettimeofday(&mtv, NULL);
|
||||||
|
Loading…
Reference in New Issue
Block a user