C language Timing

1.time (NULL) counting a minimum unit s

2.time.h

int main () {
    clock_t start, end;
    start = clock();

    end = clock();
    printf("%f",(float)(end-start)/CLK_TCK);
}

3.windows.h shows the number of ms

DWORDstart,end;
start= GetTickCount();
//…calculating…
end= GetTickCount();
printf("time=%d\n",end-start);

 

Guess you like

Origin www.cnblogs.com/Json28/p/11032006.html