#include "INotifyUpdate.h"

NotifyWidget::NotifyWidget(QWidget * parent) : QWidget(parent) {
	updateTime = 0;

	gameSecondsPerActualSecond = 1;
}

double NotifyWidget::getDifferenceFromUpdateTime() {
	if (gameSecondsPerActualSecond == 0) {
		gameSecondsPerActualSecond = 1;
	}

	if (CLOCKS_PER_SEC == 0) {
		return 0;
	}

	return (clock() - updateTime) / (double) CLOCKS_PER_SEC * gameSecondsPerActualSecond;
}

void NotifyWidget::rememberUpdateTime() {
	updateTime = clock();
}

void NotifyWidget::setGameSecondsPerActualSecond(unsigned long value) {
	this->gameSecondsPerActualSecond = value;
}