LibC: Implement basic tzset()

I still don't have timezone support so this just sets values to UTC
This commit is contained in:
Bananymous 2025-05-21 00:36:43 +03:00
parent 356935bd4f
commit a8f8d27f4e
1 changed files with 12 additions and 10 deletions

View File

@ -9,6 +9,10 @@
#include <time.h>
#include <unistd.h>
int daylight;
long timezone;
char* tzname[2];
int clock_gettime(clockid_t clock_id, struct timespec* tp)
{
return syscall(SYS_CLOCK_GETTIME, clock_id, tp);
@ -196,6 +200,14 @@ struct tm* localtime(const time_t* timer)
return localtime_r(timer, &tm);
}
void tzset()
{
daylight = 0;
timezone = 0;
tzname[0] = const_cast<char*>("UTC");
tzname[1] = const_cast<char*>("UTC");
}
size_t strftime(char* __restrict s, size_t maxsize, const char* __restrict format, const struct tm* __restrict timeptr)
{
size_t len = 0;
@ -544,13 +556,3 @@ size_t strftime(char* __restrict s, size_t maxsize, const char* __restrict forma
s[len++] = '\0';
return len;
}
#include <BAN/Assert.h>
long timezone;
void tzset()
{
ASSERT_NOT_REACHED();
}