Skip to content

Commit

Permalink
Reverted r1551 "Set property 'svn:eol-style native' on all non binary…
Browse files Browse the repository at this point in the history
… files"
  • Loading branch information
ccw808 committed Apr 28, 2010
1 parent 8cf9c41 commit 9f69b97
Show file tree
Hide file tree
Showing 3,383 changed files with 1,462,583 additions and 1,462,583 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
2,650 changes: 1,325 additions & 1,325 deletions CHANGELOG

Large diffs are not rendered by default.

1,348 changes: 674 additions & 674 deletions LICENSE

Large diffs are not rendered by default.

1,860 changes: 930 additions & 930 deletions MTA10/core/CChat.cpp

Large diffs are not rendered by default.

466 changes: 233 additions & 233 deletions MTA10/core/CChat.h

Large diffs are not rendered by default.

186 changes: 93 additions & 93 deletions MTA10/core/CClientTime.cpp
Original file line number Diff line number Diff line change
@@ -1,93 +1,93 @@
/*****************************************************************************
*
* PROJECT: Multi Theft Auto v1.0
* LICENSE: See LICENSE in the top level directory
* FILE: core/CClientTime.cpp
* PURPOSE: Easy class interface to time querying functions
* DEVELOPERS: Cecill Etheredge <[email protected]>
*
* Multi Theft Auto is available from http://www.multitheftauto.com/
*
*****************************************************************************/

#include "StdInc.h"

bool CClientTime::m_bUsePerformanceCounter = false;
LONGLONG CClientTime::m_lTimeCounts = 0;

LONGLONG CClientTime::m_lLastReading = 0;
LONGLONG CClientTime::m_lBaseReading = 0;
LONGLONG CClientTime::m_lMaxDelta = 0;
double CClientTime::m_dTickMultiply = 0;

unsigned long CClientTime::GetTime ( void )
{
#pragma message(__LOC__"(IJs) Revise this function. Use a one-time pulse query (e.g. in CCore) and a static time value for better performance!")

// Use the performance counter if initialize succeeded to initiate using it
if ( m_bUsePerformanceCounter )
{
LARGE_INTEGER lPerf;
QueryPerformanceCounter ( &lPerf );
return static_cast < unsigned long > ( lPerf.QuadPart / m_lTimeCounts );
}
else
{
// Otherwise use GetTickCount
return timeGetTime ();
}
}


double CClientTime::GetTimeNano ( void )
{
// Use the performance counter if initialize succeeded to initiate using it
if ( m_bUsePerformanceCounter )
{
long long now;
QueryPerformanceCounter((LARGE_INTEGER *)&now);
// work around dual-core bug
if (now < m_lLastReading) {
now = m_lLastReading + 1;
}
if (now - m_lLastReading > m_lMaxDelta) {
// don't advance time too much all at once
m_lBaseReading += now - m_lLastReading - m_lMaxDelta;
}
m_lLastReading = now;
return (now - m_lBaseReading) * m_dTickMultiply;
}
else
{
// Or error out
return NULL;
}
}


bool CClientTime::InitializeTime ( void )
{
#pragma message(__LOC__"Add protection for SMP (dual-core) fucking up here.")

// Try to initialize using the performance counter
LARGE_INTEGER lFrequency;
if ( QueryPerformanceFrequency ( &lFrequency ) )
{
m_lTimeCounts = lFrequency.QuadPart / 1000;
m_bUsePerformanceCounter = true;

long long tps;
QueryPerformanceFrequency ( (LARGE_INTEGER*)&tps );
m_dTickMultiply = 1.0 / (double)tps;
m_lMaxDelta = (long long)(tps * 0.1);
QueryPerformanceCounter((LARGE_INTEGER *)&m_lBaseReading);
m_lLastReading = m_lBaseReading;
}
else
{
// Use timeGetTime instead
m_bUsePerformanceCounter = false;
}

return true;
}
/*****************************************************************************
*
* PROJECT: Multi Theft Auto v1.0
* LICENSE: See LICENSE in the top level directory
* FILE: core/CClientTime.cpp
* PURPOSE: Easy class interface to time querying functions
* DEVELOPERS: Cecill Etheredge <[email protected]>
*
* Multi Theft Auto is available from http://www.multitheftauto.com/
*
*****************************************************************************/

#include "StdInc.h"

bool CClientTime::m_bUsePerformanceCounter = false;
LONGLONG CClientTime::m_lTimeCounts = 0;

LONGLONG CClientTime::m_lLastReading = 0;
LONGLONG CClientTime::m_lBaseReading = 0;
LONGLONG CClientTime::m_lMaxDelta = 0;
double CClientTime::m_dTickMultiply = 0;

unsigned long CClientTime::GetTime ( void )
{
#pragma message(__LOC__"(IJs) Revise this function. Use a one-time pulse query (e.g. in CCore) and a static time value for better performance!")

// Use the performance counter if initialize succeeded to initiate using it
if ( m_bUsePerformanceCounter )
{
LARGE_INTEGER lPerf;
QueryPerformanceCounter ( &lPerf );
return static_cast < unsigned long > ( lPerf.QuadPart / m_lTimeCounts );
}
else
{
// Otherwise use GetTickCount
return timeGetTime ();
}
}


double CClientTime::GetTimeNano ( void )
{
// Use the performance counter if initialize succeeded to initiate using it
if ( m_bUsePerformanceCounter )
{
long long now;
QueryPerformanceCounter((LARGE_INTEGER *)&now);
// work around dual-core bug
if (now < m_lLastReading) {
now = m_lLastReading + 1;
}
if (now - m_lLastReading > m_lMaxDelta) {
// don't advance time too much all at once
m_lBaseReading += now - m_lLastReading - m_lMaxDelta;
}
m_lLastReading = now;
return (now - m_lBaseReading) * m_dTickMultiply;
}
else
{
// Or error out
return NULL;
}
}


bool CClientTime::InitializeTime ( void )
{
#pragma message(__LOC__"Add protection for SMP (dual-core) fucking up here.")

// Try to initialize using the performance counter
LARGE_INTEGER lFrequency;
if ( QueryPerformanceFrequency ( &lFrequency ) )
{
m_lTimeCounts = lFrequency.QuadPart / 1000;
m_bUsePerformanceCounter = true;

long long tps;
QueryPerformanceFrequency ( (LARGE_INTEGER*)&tps );
m_dTickMultiply = 1.0 / (double)tps;
m_lMaxDelta = (long long)(tps * 0.1);
QueryPerformanceCounter((LARGE_INTEGER *)&m_lBaseReading);
m_lLastReading = m_lBaseReading;
}
else
{
// Use timeGetTime instead
m_bUsePerformanceCounter = false;
}

return true;
}
78 changes: 39 additions & 39 deletions MTA10/core/CClientTime.h
Original file line number Diff line number Diff line change
@@ -1,39 +1,39 @@
/*****************************************************************************
*
* PROJECT: Multi Theft Auto v1.0
* LICENSE: See LICENSE in the top level directory
* FILE: core/CClientTime.h
* PURPOSE: Header file for time query class
* DEVELOPERS: Cecill Etheredge <[email protected]>
*
* Multi Theft Auto is available from http://www.multitheftauto.com/
*
*****************************************************************************/

class CClientTime;

#ifndef __CCLIENTTIME_H
#define __CCLIENTTIME_H

#include <windows.h>

class CClientTime
{
friend class CCore;

public:
static unsigned long GetTime ( void );
static double GetTimeNano ( void );

private:
static bool InitializeTime ( void );

static bool m_bUsePerformanceCounter;
static LONGLONG m_lTimeCounts;
static LONGLONG m_lLastReading;
static LONGLONG m_lBaseReading;
static LONGLONG m_lMaxDelta;
static double m_dTickMultiply;
};

#endif
/*****************************************************************************
*
* PROJECT: Multi Theft Auto v1.0
* LICENSE: See LICENSE in the top level directory
* FILE: core/CClientTime.h
* PURPOSE: Header file for time query class
* DEVELOPERS: Cecill Etheredge <[email protected]>
*
* Multi Theft Auto is available from http://www.multitheftauto.com/
*
*****************************************************************************/

class CClientTime;

#ifndef __CCLIENTTIME_H
#define __CCLIENTTIME_H

#include <windows.h>

class CClientTime
{
friend class CCore;

public:
static unsigned long GetTime ( void );
static double GetTimeNano ( void );

private:
static bool InitializeTime ( void );

static bool m_bUsePerformanceCounter;
static LONGLONG m_lTimeCounts;
static LONGLONG m_lLastReading;
static LONGLONG m_lBaseReading;
static LONGLONG m_lMaxDelta;
static double m_dTickMultiply;
};

#endif
Loading

0 comments on commit 9f69b97

Please sign in to comment.