Code:
#include <stdio.h>
#include <time.h>
      
int main(){
  clock_t start = clock();
  printf("\ncalculating time elapsed,please wait!\n");
  /* Code you want timed here */
  for (int i=0;i<30000;i++)
       for (int j=0;j<30000;j++){}
  /*end timed code*/
  double timeElapsedInseconds=((double)clock() - start) / CLOCKS_PER_SEC;
  long timeElapsedInmilliseconds=(long)(1000*((double)clock() - start) / CLOCKS_PER_SEC);
  printf("Time elapsed: %f seconds\n",timeElapsedInseconds );
  printf("Time elapsed: %ld milliseconds\n",timeElapsedInmilliseconds );
  getchar();
  return 0;
}
the code is for seconds and milliseconds