#include <stdio.h>
#include <time.h>
static timespec diff(timespec start, timespec end){
timespec temp;
if ((end.tv_nsec - start.tv_nsec) < 0 ){
temp.tv_sec = end.tv_sec - start.tv_sec - 1 ;
temp.tv_nsec = 1000000000 + end.tv_nsec - start.tv_nsec;
} else {
temp.tv_sec = end.tv_sec - start.tv_sec;
temp.tv_nsec = end.tv_nsec - start.tv_nsec;
}
return temp;
}
int main(){
int i, temp;
timespec diff, time1, time2;
clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &time1);
temp = 1;
for(i = 0 ;i < 242000000 ; ++i)
temp += temp;
clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &time2);
printf("%d:%d\n", diff.tv_sec, diff.tv_nsec);
getchar();
return 0 ;
}