This is probably what you need:
#include <time.h>
#include <sys/time.h>
#include <stdio.h>
void test(){
int i;int s=0;
for(i=1; i<1000000; i++){s+=sin(i)/i;}
}
int main(void)
{
clock_t time[2], timediff;
float elapsed;
time[0] = clock();
f1();
time[1] = clock();
elapsed = ((float)abs(time[0] - time[1]))/CLOCKS_PER_SEC;
printf("Code executed in %f milliseconds.\n", elapsed);
return 0;
}