- 공유 링크 만들기
- X
- 이메일
- 기타 앱
- 공유 링크 만들기
- X
- 이메일
- 기타 앱
#include <sys/time.h>
// ...
struct timeval start, end;
long mtime;
gettimeofday(&start, NULL);
while(1)
{
gettimeofday(&end, NULL);
mtime = end.tv_sec - start.tv_sec; // 경과 시간(초)
}
반복문 내에서 1초 주기로 실행해야 되는 구문이 있을 때 사용했다.
참고 : http://stackoverflow.com/questions/588307/c-obtaining-milliseconds-time-on-linux-clock-doesnt-seem-to-work-properl
댓글
댓글 쓰기