summaryrefslogtreecommitdiff
path: root/LibC/time.cpp
blob: b1bee005573568f649e3fa52e4c55f2f021ccf18 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#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;
    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);
}

}