diff --git a/libc/generic/ansi/src/time-stubs.cpp b/libc/generic/ansi/src/time-stubs.cpp index 0dfdcd7e..ed24146f 100644 --- a/libc/generic/ansi/src/time-stubs.cpp +++ b/libc/generic/ansi/src/time-stubs.cpp @@ -15,10 +15,7 @@ time_t mktime(struct tm *ptr){ __ensure(!"Not implemented"); __builtin_unreachable(); } -time_t time(time_t *timer){ - __ensure(!"Not implemented"); - __builtin_unreachable(); -} +// time() is provided by the platform int timespec_get(struct timespec *ptr, int base){ __ensure(!"Not implemented"); __builtin_unreachable(); diff --git a/libc/platform/x86_64-managarm/dir.makefile b/libc/platform/x86_64-managarm/dir.makefile index 196c4dc5..d31aaf26 100644 --- a/libc/platform/x86_64-managarm/dir.makefile +++ b/libc/platform/x86_64-managarm/dir.makefile @@ -6,7 +6,7 @@ $c_OBJDIR := $(BUILD_PATH)/$c/obj $c_BINDIR := $(BUILD_PATH)/$c/bin $c_OBJECTS := entry.o ensure.o malloc.o file.o \ - fork-exec.o enter-fork.o \ + fork-exec.o enter-fork.o time.o \ frigg-support.o $c_OBJECT_PATHS := $(addprefix $($c_OBJDIR)/,$($c_OBJECTS)) diff --git a/libc/platform/x86_64-managarm/src/time.cpp b/libc/platform/x86_64-managarm/src/time.cpp new file mode 100644 index 00000000..5a1de4c8 --- /dev/null +++ b/libc/platform/x86_64-managarm/src/time.cpp @@ -0,0 +1,17 @@ + +#include + +#pragma GCC visibility push(hidden) + +#include + +#pragma GCC visibility pop + +time_t time(time_t *out){ + frigg::infoLogger.log() << "mlibc: Broken time() called!" << frigg::EndLog(); + time_t result = 0; + if(out) + *out = result; + return result; +} +