X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=Kernel%2Ftime.c;h=de4394724ca76f836c91b274d9ab5a1d5c7215e9;hb=92e1384ea0be30ae9ab82af6864da2806286e864;hp=dcc4f79eeb64523bde2ca237266a350463fca5c4;hpb=86f49ede5038704ac4f12eab9794e9a8110a4985;p=tpg%2Facess2.git diff --git a/Kernel/time.c b/Kernel/time.c index dcc4f79e..de439472 100644 --- a/Kernel/time.c +++ b/Kernel/time.c @@ -17,25 +17,15 @@ typedef struct sTimer { } tTimer; // === PROTOTYPES === -Sint64 now(void); void Timer_CallTimers(void); // === GLOBALS === -Uint64 giTicks = 0; -Sint64 giTimestamp = 0; -Uint64 giPartMiliseconds = 0; +volatile Uint64 giTicks = 0; +volatile Sint64 giTimestamp = 0; +volatile Uint64 giPartMiliseconds = 0; tTimer gTimers[NUM_TIMERS]; // TODO: Replace by a ring-list timer // === CODE === -/** - * \fn Sint64 now() - * \brief Return the current timestamp - */ -Sint64 now(void) -{ - return giTimestamp; -} - /** * \fn void Timer_CallTimers() */ @@ -94,12 +84,11 @@ void Time_RemoveTimer(int ID) */ void Time_Delay(int Delay) { - Sint64 dest = giTimestamp + Delay; - while(dest > giTimestamp) Threads_Yield(); + tTime dest = now() + Delay; + while(dest > now()) Threads_Yield(); } // === EXPORTS === -EXPORT(now); EXPORT(Time_CreateTimer); EXPORT(Time_RemoveTimer); EXPORT(Time_Delay);