2010-09-13から1日間の記事一覧

boost::chrono

chrono ライブラリ使えば問題なくミリ秒単位で取得できました。 車輪の再発明もいいところ。 #include <assert.h> #include <boost/chrono.hpp> #include <boost/chrono/timer.hpp> #include <Windows.h> int main(){ namespace chrono = boost::chrono; boost::chrono::timer<> t; Sleep(16); chrono::milliseconds ms = chr</windows.h></boost/chrono/timer.hpp></boost/chrono.hpp></assert.h>…

ミリ秒単位のタイマ

boost::timer が秒単位しか対応していなかったので自作した。 時間の取得は、QueryPerformanceCounter() を使用しているので、 Windows 以外だと動きません。 Linux?ナニソレ美味しいの。 #include <assert.h> #include <windows.h> #include "timer.hpp" int main(){ kmt_ex::ms</windows.h></assert.h>…