LibC: add time() implementation
This commit is contained in:
parent
692b77fb8e
commit
a15ffcb071
|
@ -11,3 +11,13 @@ int nanosleep(const struct timespec* rqtp, struct timespec* rmtp)
|
||||||
{
|
{
|
||||||
return syscall(SYS_NANOSLEEP, rqtp, 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;
|
||||||
|
}
|
Loading…
Reference in New Issue