Luna/libc/include/time.h
apio 7fb2807d0c
All checks were successful
continuous-integration/drone/push Build is passing
libc: Implement time() using clock_gettime().
The cool POSIX kids use clock_gettime() now because it has NANOSECONDS (and different clocks!),
but ANSI C prefers this function.

We can still implement it based on clock_gettime(), we just have to discard the NANOSECONDS.
2023-01-07 00:27:23 +01:00

23 lines
346 B
C

#ifndef _TIME_H
#define _TIME_H
#include <bits/clockid.h>
#include <bits/timespec.h>
#ifdef __cplusplus
extern "C"
{
#endif
/* Get the current value of a system clock. */
int clock_gettime(clockid_t id, struct timespec* ts);
/* Get the current wall clock time. */
time_t time(time_t* tp);
#ifdef __cplusplus
}
#endif
#endif