On Wed, May 05, 2021 at 06:04:11PM +0200, Sławomir Dworaczek via Exim-users wrote:
> exim.o: In function `exim_gettime':
> exim.c:(.text+0xfbe): undefined reference to `clock_gettime'
> exim.o: In function `main':
> exim.c:(.text+0x1894): undefined reference to `clock_gettime'
> collect2: ld returned 1 exit status
> make[1]: *** [exim] Error 1
>
> gcc version 4.5.2 (GCC)
What operating system and Glibc (or other C library) version?
On a Fedora 31 system:
NAME
clock_getres, clock_gettime, clock_settime - clock and time functions
SYNOPSIS
#include <time.h>
int clock_getres(clockid_t clk_id, struct timespec *res);
int clock_gettime(clockid_t clk_id, struct timespec *tp);
int clock_settime(clockid_t clk_id, const struct timespec *tp);
---> Link with -lrt (only for glibc versions before 2.17).
Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
clock_getres(), clock_gettime(), clock_settime():
_POSIX_C_SOURCE >= 199309L
On a FreeBSD 12.2 system these functions are in the C library, and the
manpage reports:
STANDARDS
The clock_gettime(), clock_settime(), and clock_getres() system calls
conform to IEEE Std 1003.1b-1993 (“POSIX.1b”).
--
Viktor.