AzerothCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
IntervalTimer Struct Reference

#include "Timer.h"

Public Member Functions

 IntervalTimer ()=default
 
void Update (time_t diff)
 
bool Passed ()
 
void Reset ()
 
void SetCurrent (time_t current)
 
void SetInterval (time_t interval)
 
time_t GetInterval () const
 
time_t GetCurrent () const
 

Private Attributes

time_t _interval {0}
 
time_t _current {0}
 

Detailed Description

Constructor & Destructor Documentation

◆ IntervalTimer()

IntervalTimer::IntervalTimer ( )
default

Member Function Documentation

◆ GetCurrent()

time_t IntervalTimer::GetCurrent ( ) const
inline
190 {
191 return _current;
192 }
time_t _current
Definition: Timer.h:196

References _current.

Referenced by World::GetNextWhoListUpdateDelaySecs(), and Weather::Update().

◆ GetInterval()

time_t IntervalTimer::GetInterval ( ) const
inline
185 {
186 return _interval;
187 }
time_t _interval
Definition: Timer.h:195

References _interval.

Referenced by World::GetNextWhoListUpdateDelaySecs(), and Weather::Weather().

◆ Passed()

bool IntervalTimer::Passed ( )
inline
162 {
163 return _current >= _interval;
164 }

References _current, and _interval.

Referenced by Weather::Update().

◆ Reset()

void IntervalTimer::Reset ( )
inline

◆ SetCurrent()

void IntervalTimer::SetCurrent ( time_t  current)
inline

◆ SetInterval()

void IntervalTimer::SetInterval ( time_t  interval)
inline

◆ Update()

void IntervalTimer::Update ( time_t  diff)
inline
153 {
154 _current += diff;
155 if (_current < 0)
156 {
157 _current = 0;
158 }
159 }

References _current.

Referenced by Weather::Update(), and World::Update().

Member Data Documentation

◆ _current

time_t IntervalTimer::_current {0}
private

◆ _interval

time_t IntervalTimer::_interval {0}
private