请问这段代码有问题吗?
为什么总是报错:
/tmp/ccAh9CTD.o: In function `main':
time.c:(.text+0x12): undefined reference to `clock_gettime'
time.c:(.text+0x2a): undefined reference to `clock_gettime'
#include <time.h>
#include <stdio.h>
void main()
{
struct timespec start;
struct timespec end;
clock_gettime(CLOCK_REALTIME,&start);
printf("hello world\n");
clock_gettime(CLOCK_REALTIME,&end);
printf("start: seconds %d,nanoseconds %d \n",start.tv_sec,start.tv_nsec);
printf("end: seconds %d,nanoseconds %d \n",end.tv_sec,end.tv_nsec);
}