看板 LinuxDev 關於我們 聯絡資訊
我自己還沒試過 但之前有google過 這是其中一個 參考看看吧 http://www.delorie.com/gnu/docs/glibc/libc_436.html ANSI C本身好像沒有支援到msec以下的精確度 但找standard library以外的library應該可以 這個用的是glibc 是linux底下的c stdandard lib 非unix家族的平台應該沒得用 ※ 引述《leslieha (哈)》之銘言: : 計算執行時間 : clock_t t1, t2; : double diff; : t1 = clock(); : funciton(); : t2 = clock(); : diff = (double)(t2 - t1)/CLOCL_PER_SEC; : 精準度可到 msec : windows 有 : QueryPerfromance : 得到CPU clock數 以及 CPU的頻率 : 精準可以到 0.xxxxxx msec : 想請問 : UNIX有其它計算時間的函式 : 可以到 usec 或是 nsec的嗎? -- The inherent vice of capitalism is the unequal sharing of blessings; the inherent virtue of socialism is the equal sharing of misery. -- Churchill -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 122.126.35.52 ※ 編輯: dozer 來自: 122.126.35.52 (01/09 23:36)