1b3e94a20d
From release 0.1.0 pre-patched archive. This includes all Red Bear modifications previously maintained as patches in local/patches/relibc/.
45 lines
982 B
C
45 lines
982 B
C
#include <err.h>
|
|
#include <stdlib.h>
|
|
#include <time.h>
|
|
|
|
#include "test_helpers.h"
|
|
|
|
int main(void) {
|
|
struct timespec tm = {0};
|
|
|
|
int cgt = clock_gettime(CLOCK_REALTIME, &tm);
|
|
ERROR_IF(clock_gettime, cgt, == -1);
|
|
|
|
cgt = clock_getres(CLOCK_REALTIME, &tm);
|
|
ERROR_IF(clock_getres, cgt, == -1);
|
|
|
|
cgt = timespec_get(&tm, TIME_UTC);
|
|
if (cgt != TIME_UTC) {
|
|
errx(
|
|
EXIT_FAILURE,
|
|
"timespec_get should have returned %d but returned %d\n",
|
|
TIME_UTC,
|
|
cgt
|
|
);
|
|
}
|
|
|
|
cgt = timespec_getres(&tm, TIME_UTC);
|
|
if (cgt != TIME_UTC) {
|
|
errx(
|
|
EXIT_FAILURE,
|
|
"timespec_getres should have returned %d but returned %d\n",
|
|
TIME_UTC,
|
|
cgt
|
|
);
|
|
}
|
|
|
|
time_t t = time(NULL);
|
|
ERROR_IF(time, t, == (time_t)-1);
|
|
|
|
// TODO: Support clock() on Redox
|
|
// clock_t c = clock();
|
|
// ERROR_IF(clock, c, == (clock_t)-1);
|
|
|
|
return EXIT_SUCCESS;
|
|
}
|