mirror of
https://github.com/VCMP-SqMod/SqMod.git
synced 2024-11-09 01:07:16 +01:00
2aa7e8b7c2
Tighten the safety of exported functions to avoid exceptions leaking outside the host plugin.
101 lines
2.5 KiB
C++
101 lines
2.5 KiB
C++
#ifndef _LIBRARY_CHRONO_TIMER_HPP_
|
|
#define _LIBRARY_CHRONO_TIMER_HPP_
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
#include "Library/Chrono.hpp"
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
namespace SqMod {
|
|
|
|
/* ------------------------------------------------------------------------------------------------
|
|
*
|
|
*/
|
|
class Timer
|
|
{
|
|
/* --------------------------------------------------------------------------------------------
|
|
*
|
|
*/
|
|
Timer(Int64 t)
|
|
: m_Timestamp(t)
|
|
{
|
|
/* ... */
|
|
}
|
|
|
|
public:
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
*
|
|
*/
|
|
Timer();
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
*
|
|
*/
|
|
Timer(const Timer & o)
|
|
: m_Timestamp(o.m_Timestamp)
|
|
{
|
|
/* ... */
|
|
}
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
*
|
|
*/
|
|
~Timer()
|
|
{
|
|
/* ... */
|
|
}
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
*
|
|
*/
|
|
Timer & operator = (const Timer o)
|
|
{
|
|
m_Timestamp = o.m_Timestamp;
|
|
return *this;
|
|
}
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
* ...
|
|
*/
|
|
Int32 Cmp(const Timer & b) const;
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
* ...
|
|
*/
|
|
CSStr ToString() const;
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
*
|
|
*/
|
|
void Reset();
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
*
|
|
*/
|
|
Timestamp Restart();
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
*
|
|
*/
|
|
Int64 RestartRaw();
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
*
|
|
*/
|
|
Timestamp GetElapsedTime() const;
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
*
|
|
*/
|
|
Int64 GetElapsedTimeRaw() const;
|
|
|
|
private:
|
|
|
|
// --------------------------------------------------------------------------------------------
|
|
Int64 m_Timestamp;
|
|
};
|
|
|
|
} // Namespace:: SqMod
|
|
|
|
#endif // _LIBRARY_CHRONO_TIMER_HPP_
|