How to get the current time in milliseconds in C Programming?

http://stackoverflow.com/questions/8558625/how-to-get-the-current-time-in-milliseconds-in-c-programming

#include<stdio.h>   
#include<time.h>   

int main()   
{   
 clock_t t1, t2;

 t1 = clock();   

 int i;

 for(i = 0;i < 1000000 ;i++)   
 {   
      int x = 90;  
 }   

 t2 = clock();   

 float diff = (((float)t2 - (float)t1) / 1000000.0F ) * 1000;   
 printf("%f",diff);   

 return 0;   
 }
發佈了5 篇原創文章 · 獲贊 2 · 訪問量 13萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章