在c99中使用clock_gettime时出现编译错误

当我在我的代码片段中使用clock_gettime,并使用标志-std = c99进行编译时,我收到如下错误:

warning: implicit declaration of function 'clock_gettime' error: 'CLOCK_REALTIME' undeclared (first use in this function) 

我已经包含了’time.h’文件。 任何人都知道如何解决它。

在原始代码中使用-std = c99,尝试添加

 #define _POSIX_C_SOURCE >= 199309L 

clock_gettime的手册页表明这是必要的function测试宏要求。