Skip to content

Commit 42e1358

Browse files
Christian Rieschdavem330
authored andcommitted
ptp: In the testptp utility, use clock_adjtime from glibc when available
clock_adjtime was included in glibc 2.14. _GNU_SOURCE must be defined to make it available. Signed-off-by: Christian Riesch <christian.riesch@omicron.at> Cc: Richard Cochran <richardcochran@gmail.com> Acked-by: Richard Cochran <richardcochran@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent ddc6fbd commit 42e1358

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

‎Documentation/ptp/testptp.c‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
* along with this program; if not, write to the Free Software
1818
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
1919
*/
20+
#define _GNU_SOURCE
2021
#include <errno.h>
2122
#include <fcntl.h>
2223
#include <inttypes.h>
@@ -46,12 +47,14 @@
4647
#define CLOCK_INVALID -1
4748
#endif
4849

49-
/* When glibc offers the syscall, this will go away. */
50+
/* clock_adjtime is not available in GLIBC < 2.14 */
51+
#if !__GLIBC_PREREQ(2, 14)
5052
#include <sys/syscall.h>
5153
static int clock_adjtime(clockid_t id, struct timex *tx)
5254
{
5355
return syscall(__NR_clock_adjtime, id, tx);
5456
}
57+
#endif
5558

5659
static clockid_t get_clockid(int fd)
5760
{

0 commit comments

Comments
 (0)