Luna/libs/libc/src/time.cpp
apio bf026d0dea libc: Add bad time() function
It's just an alias for clock(). Which is not good. But it's a stub, that's the point.
2022-10-21 18:32:01 +02:00

20 lines
538 B
C++

#include <sys/syscall.h>
#include <time.h>
#include <unistd.h>
extern "C"
{
clock_t clock()
{
return syscall(SYS_clock);
}
time_t time(
time_t* tloc) // Very big FIXME: This is not the time of day, this just returns the same as clock() but in
// seconds. This is definitely wrong, but I'm not implementing a whole time system right now.
{
time_t result = (time_t)(syscall(SYS_clock) / CLOCKS_PER_SEC);
if (tloc) { *tloc = result; }
return result;
}
}