mirror of
https://github.com/RGBCube/serenity
synced 2025-05-30 15:38:12 +00:00
24 lines
450 B
C++
24 lines
450 B
C++
#include "time.h"
|
|
#include "errno.h"
|
|
#include <Kernel/Syscall.h>
|
|
|
|
extern "C" {
|
|
|
|
time_t time(time_t* tloc)
|
|
{
|
|
struct timeval tv;
|
|
struct timezone tz;
|
|
if (gettimeofday(&tv, &tz) < 0)
|
|
return (time_t)-1;
|
|
if (tloc)
|
|
*tloc = tv.tv_sec;
|
|
return tv.tv_sec;
|
|
}
|
|
|
|
int gettimeofday(struct timeval* tv, struct timezone*)
|
|
{
|
|
int rc = Syscall::invoke(Syscall::SC_gettimeofday, (dword)tv);
|
|
__RETURN_WITH_ERRNO(rc, rc, -1);
|
|
}
|
|
|
|
}
|