clock_gettime : Return the current timespec value of tp for the specified clock #include <time.h> // -lrt int main() { struct timespec mytime; clock_gettime(CLOCK_REALTIME, &mytime); printf("clock time is [%ld.%09ld]\n", mytime.tv_sec, mytime.tv_nsec); } * 컴파일 시 -lrt 옵션을 추가한다. (해당 함수의 사용을 위해 librt 라이브러리를 추가)