LibC: Define timezone structure

This commit is contained in:
Bananymous 2024-12-02 08:27:38 +02:00
parent a10ca47657
commit 11b6ee423e
2 changed files with 8 additions and 1 deletions

View File

@ -22,6 +22,12 @@ struct itimerval
#define ITIMER_VIRTUAL 1
#define ITIMER_PROF 2
struct timezone
{
int tz_minuteswest; /* minutes west of Greenwich */
int tz_dsttime; /* type of DST correction */
};
int getitimer(int which, struct itimerval* value);
int gettimeofday(struct timeval* __restrict tp, void* __restrict tzp);
int setitimer(int which, const struct itimerval* __restrict value, struct itimerval* __restrict ovalue);

View File

@ -6,7 +6,8 @@
int gettimeofday(struct timeval* __restrict tp, void* __restrict tzp)
{
// If tzp is not a null pointer, the behavior is unspecified.
(void)tzp;
if (tzp != nullptr)
*static_cast<struct timezone*>(tzp) = {};
timespec ts;
clock_gettime(CLOCK_REALTIME, &ts);