LibC: Update struct tm to be POSIX issue 8 compliant

This commit is contained in:
Bananymous 2025-08-11 18:59:20 +03:00
parent 1a6c5deb4b
commit 9b09d2b47a
2 changed files with 15 additions and 10 deletions

View File

@ -1,7 +1,7 @@
#ifndef _TIME_H #ifndef _TIME_H
#define _TIME_H 1 #define _TIME_H 1
// https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/time.h.html // https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/time.h.html
#include <sys/cdefs.h> #include <sys/cdefs.h>
@ -32,7 +32,9 @@ struct tm
int tm_year; /* Years since 1900. */ int tm_year; /* Years since 1900. */
int tm_wday; /* Day of week [0,6] (Sunday =0). */ int tm_wday; /* Day of week [0,6] (Sunday =0). */
int tm_yday; /* Day of year [0,365]. */ int tm_yday; /* Day of year [0,365]. */
int tm_isdst; /* Daylight Savings flag. */ int tm_isdst; /* Daylight Saving flag. */
long tm_gmtoff; /* Seconds east of UTC. */
const char* tm_zone; /* Timezone abbreviation */
}; };
struct timespec struct timespec

View File

@ -190,6 +190,9 @@ struct tm* gmtime_r(const time_t* timer, struct tm* __restrict result)
result->tm_year -= 1900; result->tm_year -= 1900;
result->tm_isdst = 0; result->tm_isdst = 0;
result->tm_gmtoff = 0;
result->tm_zone = "UTC";
return result; return result;
} }