summaryrefslogtreecommitdiffhomepage
path: root/Private/Source/Timer.cxx
blob: 73343fad3a200a3c1eb106a715b9d312ec306671 (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
26
27
28
29
/*
 *	========================================================
 *
 *	hCore
 * 	Copyright 2024 Mahrouss Logic, all rights reserved.
 *
 * 	========================================================
 */

#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;
}