nano sec

#include <time.h>
/*
struct timespec {
time_t tv_sec; // seconds
long tv_nsec; // nanoseconds
};
*/

main()
{
struct timespec tp;
int rs;

rs = clock_gettime(CLOCK_REALTIME, &tp);
printf("%ld %ld\n", tp.tv_sec, tp.tv_nsec);
rs = clock_gettime(CLOCK_REALTIME, &tp);
printf("%ld %ld\n", tp.tv_sec, tp.tv_nsec);
return 0;
}

$ gcc -o test test.c -lrt



http://kldp.org/node/56996

by 섹시미루 | 2008/06/24 17:12 | embedded Linux | 트랙백

※ 로그인 사용자만 덧글을 남길 수 있습니다.

◀ 이전 페이지          다음 페이지 ▶