/*
* [U]NITED [G]AMING [C]HEATS Client Hook
*
* Copyright (c) LIQUID     2001-2002
* Copyright (c) ZOOLABUS   2001-2002
* 
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU General Public License for more details.
* 
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
* 
* GNU license doesn't cover Engine directory.
* Content of Engine directory is copyrighted (c) 1999, 2000, by Valve LLC
* and it is licensed under Valve's proprietary license (see original HL SDK).
*/

#include <windows.h>
#include <mmsystem.h>
#include "timehandling.h"

//========================================================================================
float  ClientTime::mapTime    = 0;
double ClientTime::current    = 0;
DWORD  ClientTime::current_ms = 0;

//===========================================================
void ClientTime::reportMapTime(float mapTimeNew)
{
	// map change detection
	if( mapTimeNew < mapTime-10 ) // time decreased (looks like a mapchange)
	{
		void AtMapChange();
		AtMapChange();
	}
	mapTime = mapTimeNew;
	updateCurrentTime();
}

//========================================================================================
void ClientTime::updateCurrentTime()
{
	// timer update
	current_ms = timeGetTime();

	//void Con_Echo(const char *fmt, ... );
	current = (double)current_ms / 1000.0;
	//Con_Echo("cur_ms:%d cur:%f",current_ms,current);
}
