From c47c954d958fd839eb32ff721b0c69f142d3b40c Mon Sep 17 00:00:00 2001 From: Andre Noll Date: Mon, 26 Dec 2016 16:16:36 +0100 Subject: [PATCH] build: Remove compatibility check for clock_gettime(). Only Mac OS (which is no longer supported) did not have it. Moreover, on Linux we used to check whether one needs to link with -lrt to obtain clock_gettime(), which is necessary for glibc versions 2.16 and earlier (released in 2012). All distributions should have moved on to newer glibc versions by now, so let's get rid of the check. --- Makefile.in | 1 - Makefile.real | 2 -- configure.ac | 13 ------------- time.c | 20 ++++++-------------- 4 files changed, 6 insertions(+), 30 deletions(-) diff --git a/Makefile.in b/Makefile.in index d6830ded..3c51029b 100644 --- a/Makefile.in +++ b/Makefile.in @@ -52,7 +52,6 @@ alsa_cppflags := @alsa_cppflags@ oss_cppflags := @oss_cppflags@ mp4v2_cppflags := @mp4v2_cppflags@ -clock_gettime_ldflags := @clock_gettime_ldflags@ id3tag_ldflags := @id3tag_ldflags@ ogg_ldflags := @ogg_ldflags@ vorbis_ldflags := @vorbis_ldflags@ diff --git a/Makefile.real b/Makefile.real index ad83809c..8a8cd434 100644 --- a/Makefile.real +++ b/Makefile.real @@ -113,8 +113,6 @@ STRICT_CFLAGS += -Wformat -Wformat-security STRICT_CFLAGS += -Wmissing-format-attribute STRICT_CFLAGS += -Wdeclaration-after-statement -LDFLAGS += $(clock_gettime_ldflags) - ifeq ($(uname_s),Linux) # these cause warnings on *BSD CPPFLAGS += -Wunused-macros diff --git a/configure.ac b/configure.ac index ec8cbac2..afed0a79 100644 --- a/configure.ac +++ b/configure.ac @@ -71,19 +71,6 @@ AC_PROG_CC AC_PROG_CPP executables="recv filter audioc write afh play" -################################################################## clock_gettime -clock_gettime_lib= -AC_CHECK_LIB([c], [clock_gettime], [clock_gettime_lib=c], [ - AC_CHECK_LIB([rt], [clock_gettime], [clock_gettime_lib=rt], [], []) -]) -if test -n "$clock_gettime_lib"; then - AC_DEFINE(HAVE_CLOCK_GETTIME, 1, [ - define to 1 if clock_gettime() is supported]) -fi -if test "$clock_gettime_lib" = "rt"; then - AC_SUBST(clock_gettime_ldflags, -lrt) -fi - ########################################################################### osl STASH_FLAGS LIB_ARG_WITH([osl], [-losl]) diff --git a/time.c b/time.c index 6bb9a50f..90c67356 100644 --- a/time.c +++ b/time.c @@ -198,22 +198,14 @@ void compute_chunk_time(long unsigned chunk_num, struct timeval *clock_get_realtime(struct timeval *tv) { static struct timeval user_friendly; + struct timespec t; + int ret; if (!tv) tv = &user_friendly; -#ifdef HAVE_CLOCK_GETTIME - { - struct timespec t; - int ret; - - ret = clock_gettime(CLOCK_REALTIME, &t); - assert(ret == 0); - tv->tv_sec = t.tv_sec; - tv->tv_usec = t.tv_nsec / 1000; - } -#else - #include - gettimeofday(tv, NULL); -#endif /* HAVE_CLOCK_GETTIME */ + ret = clock_gettime(CLOCK_REALTIME, &t); + assert(ret == 0); + tv->tv_sec = t.tv_sec; + tv->tv_usec = t.tv_nsec / 1000; return tv; } -- 2.39.2