Skip to content

Commit

Permalink
fixes zardus#69
Browse files Browse the repository at this point in the history
  • Loading branch information
acidghost committed Nov 1, 2020
1 parent 7dc3739 commit 35f6fe8
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/detime.c
Expand Up @@ -4,6 +4,7 @@
#include <time.h>
#ifdef __unix__
#include <sys/time.h>
#include <features.h>
#endif

#include "logging.h"
Expand All @@ -21,7 +22,11 @@ time_t time(time_t *res)
}

#ifdef __unix__
#if __GLIBC_PREREQ(2, 31)
int gettimeofday(struct timeval *tv, void *__restrict tz)
#else
int gettimeofday(struct timeval *tv, struct timezone *tz)
#endif
{

char *sec_str = getenv("TV_SEC");
Expand All @@ -32,6 +37,8 @@ int gettimeofday(struct timeval *tv, struct timezone *tz)
preeny_debug("gettimeofday frozen at %ld.%d\n", tv->tv_sec, tv->tv_usec);


#if __GLIBC_PREREQ(2, 31)
#else
if (tz != NULL) {
char *minwest_str = getenv("TZ_MINWEST");
char *dst_str = getenv("TZ_DSTTIME");
Expand All @@ -40,6 +47,7 @@ int gettimeofday(struct timeval *tv, struct timezone *tz)

preeny_debug("gettimeofday tz frozen at -%d minm, DST: %d\n", tz->tz_minuteswest, tz->tz_dsttime);
}
#endif

return 0;
}
Expand Down

2 comments on commit 35f6fe8

@nataraj-hates-MS-for-stealing-github

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've checked this patch both with
Debian Buster's glibc 2.28
and
Ubuntu Groovy's glibc 2.32
It works for both of them.

Can you pull-request it into https://github.com/zardus/ please.
It will save me some from patching it manually each time...

And thanks for the patch nevertheless....

@acidghost
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.