3
我該如何獲得C中的當前時間(以毫秒爲單位)?我做以下,以獲得時間(秒):如何使用C獲取以毫秒爲單位的當前時間?
struct tm ptm;
now = time(NULL);
localtime_r(&now,ptm);
myTime= (ptm->tm_hour * 3600) + (ptm->tm_min * 60) + (ptm->tm_sec);
在time.h中尋找,struct tm
沒有在它的毫秒成員。
參見http://stackoverflow.com/questions/361363/how-to-measure-time-in-milliseconds-using-ansi- c http://stackoverflow.com/questions/173409/how-can-i-find-the-execution-time-of-a-section-of-my-program-in-c – 2009-09-02 22:05:05