// ################################
// ##    Funkce pro mapovani     ##
// ##  herniho a realneho casu   ##
// ################################

#include "time_mapping.h"

#ifdef _DEBUG
#ifndef DEBUG_NEW
#define DEBUG_NEW new(_NORMAL_BLOCK, __FILE__, __LINE__)
#define new DEBUG_NEW
#endif
#endif

// ################################
// ################################

dateTimeDateTimePair gameTimeEQWallTime;

// ################################
// ################################

dv_time::datetime wt2gt(dv_time::datetime wallTime)
{
	return (gameTimeEQWallTime.first  + (wallTime - gameTimeEQWallTime.second) * (double)GAME_TIME_TO_WALL_TIME_SPEED_RATIO);
};

// --------------------------------

dv_time::datetime gt2wt(dv_time::datetime gameTime)
{
	return (gameTimeEQWallTime.second + (gameTime - gameTimeEQWallTime.first ) / (double)GAME_TIME_TO_WALL_TIME_SPEED_RATIO);
};

// ################################
// ################################

dv_time::datetime wt2gtRelative(dv_time::datetime wallTime)
{
	return (wallTime * (double)GAME_TIME_TO_WALL_TIME_SPEED_RATIO);
};

// --------------------------------

dv_time::datetime gt2wtRelative(dv_time::datetime gameTime)
{
	return (gameTime / (double)GAME_TIME_TO_WALL_TIME_SPEED_RATIO);
};

// ################################
// ################################

