#include "time.h"

#include <sys/time.h>

#include <stdio.h>


long clockCheck()

{

struct timeval tv;

gettimeofday(&tv, NULL);

return (tv.tv_sec * 1000 + tv_usec / 1000);

}


voie time::check()

{

long start, end;

start = clockCheck();

load();

end = clockCheck() - start;


printf("%ld.%ld sec \r\n", end / 1000, end % 1000);

}

함수나 반복문 관련해서 처리되는 시간 측정이 필요한 경우가 있다.

방법은 다음과 같다.


NSDate* fsTime = [NSDate date];

for (...)

{

...

}

NSTimeInterval lsTime = -[fsTime timeIntervalSinceNow];

NSLog(@"%f sec", lsTime);

+ Recent posts