luxos/Kernel/hal/clock/clock.c
Tiberiu Chibici 17342b6665 [????] BUILD 0.1.1.50 DATE 9/20/2011 AT 12:43 PM
====================================================
Mainly changed: Tasking
+ Implemented multitasking
+ Switching works
? TODO: Fix other not working tasking routines
2021-09-14 18:58:06 +03:00

24 lines
462 B
C

#include <time.h>
#include "clock.h"
#define MILISECONDS_IN_DAY 86400000
volatile TimeSystem _internal_time;
uint32 _internal_frequency_hz;
extern void TaskSwitch (_RegsStack32* regs);
void TimeHandler(_RegsStack32* r)
{
if (_internal_frequency_hz == 0) return;
_internal_time.Time += 1000/_internal_frequency_hz;
if (_internal_time.Time >= MILISECONDS_IN_DAY)
{
_internal_time.Date++;
_internal_time.Time-=MILISECONDS_IN_DAY;
}
TaskSwitch(r);
}