mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-01-23 17:52:26 -05:00
dc6f57f19c
This only has second accuracy right now, I'll work out subseconds later.
21 lines
350 B
C++
21 lines
350 B
C++
#include "time.h"
|
|
#include "errno.h"
|
|
#include <Kernel/Syscall.h>
|
|
|
|
extern "C" {
|
|
|
|
time_t time(time_t* tloc)
|
|
{
|
|
timeval tv;
|
|
if (gettimeofday(&tv) < 0)
|
|
return (time_t)-1;
|
|
return tv.tv_sec;
|
|
}
|
|
|
|
int gettimeofday(timeval* tv)
|
|
{
|
|
int rc = Syscall::invoke(Syscall::PosixGettimeofday, (dword)tv);
|
|
__RETURN_WITH_ERRNO(rc, rc, -1);
|
|
}
|
|
|
|
}
|