LibC: add time() implementation

This commit is contained in:
Bananymous 2023-09-04 13:52:58 +03:00
parent dfb18d38f7
commit 7184514b5d
1 changed files with 10 additions and 0 deletions

View File

@ -11,3 +11,13 @@ int nanosleep(const struct timespec* rqtp, struct timespec* rmtp)
{
return syscall(SYS_NANOSLEEP, rqtp, rmtp);
}
time_t time(time_t* tloc)
{
timespec tp;
if (clock_gettime(CLOCK_REALTIME, &tp) == -1)
return -1;
if (tloc)
*tloc = tp.tv_sec;
return tp.tv_sec;
}