Re: [問題] unix下 c++程式 CLOCKS_PER_SEC 與CLK_ …

看板C_and_CPP作者 ( 殺手哥吉拉 13)時間15年前 (2009/02/13 00:26), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串4/7 (看更多)
※ 引述《allanyh (allan)》之銘言: : ※ 引述《WalkingIce ( 殺手哥吉拉 13)》之銘言: : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ : 感謝W兄的解答,再請教 如果 CLOCKS_PER_SEC=1000000, : 那上面這一行會是相當把clock數換算成於秒數嗎?? : 非常感謝 : : 看看 header 檔就知道了。(or "man 3 clock") : : /usr/include/bits/time.h : : CLK_TCK 這個數字是 100,它來自於 sysconf(2) : : clock ticks - _SC_CLK_TCK : : The number of clock ticks per second. The corresponding variable : : is obsolete. It was of course called CLK_TCK. (Note: the macro : : CLOCKS_PER_SEC does not give information: it must equal 1000000.) 就像這一段的解釋, CLOCKS_PER_SEC 沒有給你甚麼訊息。 你要除以 CLK_TCK 就會得到秒數了 -- 有一天小明跟朋友打牌,有張牌不小心掉進水裡。此時女神出現了 女神:「你掉的是這張紅中,還是這張白板?」 小明:「都不是,我掉的是青發。快還我吧大嬸,我缺那張牌就自摸了」 女神:「.................(不爽)」 「你真是誠實的好孩子,紅中跟白板都送你吧」 於是小明就相公了。 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 123.194.177.157
文章代碼(AID): #19b4slQ4 (C_and_CPP)
討論串 (同標題文章)
文章代碼(AID): #19b4slQ4 (C_and_CPP)