2004年09月12日
UNIX時間のマイクロ秒を取得できる。
#include <stdio.h>
#include <sys/time.h>
int main(int argc, char *argv[])
{
struct timeval tp;
if ( gettimeofday(&tp, NULL) )
{
perror("error!\n");
}
printf("seconds sinze Jan. 1, 1970\t:%10ld\n", tp.tv_sec);
printf("and microseconds \t:%10ld\n", tp.tv_usec);
return 0;
}