mirror of
https://github.com/thunderbrewhq/thunderbrew
synced 2025-12-14 12:02:30 +00:00
chore: initial commit
This commit is contained in:
commit
70b00c5c38
965 changed files with 264882 additions and 0 deletions
29
src/event/Timer.cpp
Normal file
29
src/event/Timer.cpp
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
#include "event/Timer.hpp"
|
||||
#include "event/EvtContext.hpp"
|
||||
#include "event/EvtTimer.hpp"
|
||||
#include <storm/Error.hpp>
|
||||
|
||||
int32_t IEvtTimerDispatch(EvtContext* context) {
|
||||
// TODO
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint32_t IEvtTimerGetNextTime(EvtContext* context, uint32_t currTime) {
|
||||
STORM_ASSERT(context);
|
||||
|
||||
context->m_critsect.Enter();
|
||||
|
||||
uint32_t nextTime = -1;
|
||||
|
||||
if (context->m_timerQueue.Count()) {
|
||||
auto queue = static_cast<EvtTimer*>(context->m_timerQueue[0]);
|
||||
auto targetTime = queue->targetTime.m_val;
|
||||
nextTime = targetTime - currTime;
|
||||
nextTime = nextTime < 0 ? 0 : nextTime;
|
||||
}
|
||||
|
||||
context->m_critsect.Leave();
|
||||
|
||||
return nextTime;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue