summaryrefslogtreecommitdiffhomepage
path: root/Private/Source/Timer.cxx
blob: ecca679aa357bb0d0eda8be649ced5e727f7a0f6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
/* -------------------------------------------

    Copyright Mahrouss Logic

------------------------------------------- */

#include <KernelKit/Timer.hpp>

// bugs = 0

using namespace HCore;

Int32 HardwareTimerInterface::Wait() noexcept { return H_UNIMPLEMENTED; }

HardwareTimer::HardwareTimer(Int64 seconds) : fWaitFor(seconds) {}
HardwareTimer::~HardwareTimer() { fWaitFor = 0; }

Int32 HardwareTimer::Wait() noexcept {
  if (fWaitFor < 1) return -1;

  while (*fDigitalTimer < (*fDigitalTimer + fWaitFor)) {
  }

  return 0;
}