summaryrefslogtreecommitdiffhomepage
path: root/Source/Timer.cxx
blob: 13e66337296bae8b53b7ffc275550e8e50bb39c8 (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
/*
 *	========================================================
 *
 *	hCore
 * 	Copyright Mahrouss Logic, all rights reserved.
 *
 * 	========================================================
 */

#include <KernelKit/Timer.hpp>

// bugs = 0

using namespace hCore;

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

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

    while (*fDigitalTimer < (*fDigitalTimer + fWaitFor))
        ;

    return 0;
}