historical/gems-kernel.git/source/time.h

70 lines
1 KiB
C
Raw Normal View History

2024-01-16 11:20:27 -06:00
//Made to create time at 100000000 TPS
//by Sparksammy
int time = 1;
void countOld() {
static long long int i;
static int state = 0;
switch (state)
{
case 0: /* start of function */
while (1 == 1) {
time++;
}
/* Returns control */
case 1:; /* resume control straight
after the return */
}
state = 0;
return 0;
}
void halt() {
// do nothing.
}
void wait(uint32_t millis) {
uint32_t countdown = millis * 1193181.66667;
while (countdown > 0) {
uint32_t countdown = countdown - 1;
}
}
void waitSecs(int secs) {
uint32_t end = end * 1000;
wait(end);
}
bool countstate = false;
int time2 = 0;
// New count feature cuz why not?
// They are all counted in seconds
void Count() {
while (countstate == true) {
waitSecs(1);
time2++;
}
}
// get time from the new count feature
int getTime() {
return time2;
}
// Sets time in seconds
int setTime(int sec) {
time2 = sec;
}
void disableCount() {
countstate = false;
}
void enableCount() {
countstate = true;
}