From: slack Date: Thu, 19 Aug 2010 03:04:57 +0000 (+0200) Subject: Changed time measurements for FPS display X-Git-Url: http://slack.codemaniacs.com/git/?a=commitdiff_plain;h=fb47fea808c9f2bcbee654fb3ea8def123592594;p=wenboi.git Changed time measurements for FPS display from clock_gettime to QTime. Now builds on windows again :) --- diff --git a/qtboi/QtBoiMainWindow.cc b/qtboi/QtBoiMainWindow.cc index fd69631..bdfd9ee 100644 --- a/qtboi/QtBoiMainWindow.cc +++ b/qtboi/QtBoiMainWindow.cc @@ -11,8 +11,10 @@ #include #include #include +#include #include +#include #include "QtBoiMainWindow.h" #include "../core/GameBoy.h" @@ -83,9 +85,8 @@ QtBoiMainWindow::QtBoiMainWindow(QWidget *parent) last_FPS_update=0.0f; frames_since_last_FPS_update=0; - struct timespec tp; - clock_gettime(CLOCK_REALTIME, &tp); - init_seconds = tp.tv_sec; + time = QTime::currentTime(); + time.start(); } QtBoiMainWindow::~QtBoiMainWindow() @@ -555,9 +556,7 @@ void QtBoiMainWindow::saveTags() double QtBoiMainWindow::now() { - struct timespec tp; - clock_gettime(CLOCK_REALTIME, &tp); - return (tp.tv_sec-init_seconds) + (tp.tv_nsec*1e-9); + return time.elapsed()/1000.0; } diff --git a/qtboi/QtBoiMainWindow.h b/qtboi/QtBoiMainWindow.h index 75d0a6e..0293277 100644 --- a/qtboi/QtBoiMainWindow.h +++ b/qtboi/QtBoiMainWindow.h @@ -13,6 +13,7 @@ #include #include #include +#include #include "QtBoiEmuThread.h" #include "QtBoiDisassemblyWindow.h" @@ -99,6 +100,8 @@ class QtBoiMainWindow: public QMainWindow QAction *debugVideoDrawBackground; QAction *debugVideoDrawWindow; QAction *debugVideoDrawSprites; + + QTime time; };