From 81c337cf9a37123769683e7dd16ed84ac3f9ba73 Mon Sep 17 00:00:00 2001 From: apio Date: Sat, 22 Oct 2022 12:17:48 +0200 Subject: [PATCH] libc: Add struct tm and localtime(), gmtime() stubs --- libs/libc/include/time.h | 19 +++++++++++++++++++ libs/libc/src/time.cpp | 11 +++++++++++ 2 files changed, 30 insertions(+) diff --git a/libs/libc/include/time.h b/libs/libc/include/time.h index 2051b46d..9069c42d 100644 --- a/libs/libc/include/time.h +++ b/libs/libc/include/time.h @@ -4,6 +4,22 @@ typedef long int clock_t; typedef long int time_t; +struct tm +{ + int tm_sec; + int tm_min; + int tm_hour; + int tm_mday; + int tm_mon; + int tm_year; + int tm_wday; + int tm_yday; + int tm_isdst; + + long tm_gmtoff; + const char* tm_zone; +}; + #define CLOCKS_PER_SEC 1000 #ifdef __cplusplus @@ -18,6 +34,9 @@ extern "C" /* FIXME: For now, is an alias for clock(), but in seconds. */ time_t time(time_t* tloc); + struct tm* localtime(const time_t* timep); // Not implemented. + struct tm* gmtime(const time_t* timep); // Not implemented. + #ifdef __cplusplus } #endif diff --git a/libs/libc/src/time.cpp b/libs/libc/src/time.cpp index 85d553f6..d6d8b441 100644 --- a/libs/libc/src/time.cpp +++ b/libs/libc/src/time.cpp @@ -1,3 +1,4 @@ +#include #include #include #include @@ -17,4 +18,14 @@ extern "C" if (tloc) { *tloc = result; } return result; } + + struct tm* localtime(const time_t*) + { + NOT_IMPLEMENTED("localtime"); + } + + struct tm* gmtime(const time_t*) + { + NOT_IMPLEMENTED("gmtime"); + } } \ No newline at end of file