Move git root from Client/ to src/ to track all source code: - Client: Game client source (moved to Client/Client/) - Server: Game server source - GameTools: Development tools - CryptoSource: Encryption utilities - database: Database scripts - Script: Game scripts - rylCoder_16.02.2008_src: Legacy coder tools - GMFont, Game: Additional resources 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
53 lines
1.3 KiB
C++
53 lines
1.3 KiB
C++
#ifndef _RYL_BASE_LIBRARY_PULSE_H_
|
|
#define _RYL_BASE_LIBRARY_PULSE_H_
|
|
|
|
#include <winsock2.h>
|
|
#include <windows.h>
|
|
|
|
#pragma comment(lib, "winmm.lib")
|
|
|
|
// Single ThreadÀü¿ëÀÓ.
|
|
class CPulse
|
|
{
|
|
public:
|
|
|
|
enum PulseConst
|
|
{
|
|
DEFAULT_TICKS_PER_PULSE = 100
|
|
};
|
|
|
|
static CPulse& GetInstance();
|
|
|
|
unsigned long CheckSleep();
|
|
|
|
void SetTicksPerPulse(long nTicksPerPulse);
|
|
|
|
long GetTicksPerPulse() const { return m_nTicksPerPulse; }
|
|
long GetTicksPerSec() const { return m_nTicksPerSec; }
|
|
|
|
unsigned long GetRemainTime() const;
|
|
|
|
BOOL GetTPPOverTwoTime() const { return m_bTPPOverTwoTime; }
|
|
unsigned long GetCurrentPulse() const { return m_dwPulse; }
|
|
unsigned long GetLastTick() const { return m_dwLastTick; }
|
|
|
|
inline bool ProcessBySecond(unsigned long dwCycleSec) const { return (0 == (m_dwPulse % (dwCycleSec * m_nTicksPerSec))); }
|
|
inline bool ProcessByMinute(unsigned long dwCycleMin) const { return ProcessBySecond(dwCycleMin * 60); }
|
|
inline bool ProcessByHour(unsigned long dwCycleHour) const { return ProcessBySecond(dwCycleHour * 3600); }
|
|
|
|
private:
|
|
|
|
CPulse();
|
|
~CPulse();
|
|
|
|
unsigned long m_dwPulse;
|
|
unsigned long m_dwLastTick;
|
|
unsigned long m_dwHeavyTrafficCount;
|
|
|
|
long m_nTicksPerPulse;
|
|
long m_nTicksPerSec;
|
|
|
|
BOOL m_bTPPOverTwoTime;
|
|
};
|
|
|
|
#endif |