Closed ghost closed 3 years ago
I don't have arch. Be the change you want to see in the world :-)
@zardus what information could I provide to help you? :)
this is caused by glibc-2.31
The gettimeofday function no longer reports information about a system-wide time zone. This 4.2-BSD-era feature has been deprecated for many years, as it cannot handle the full complexity of the world's timezones, but hitherto we have supported it on a best-effort basis. Changes required to support 64-bit time_t on 32-bit architectures have made this no longer practical.
As of this release, callers of gettimeofday with a non-null 'tzp' argument should expect to receive a 'struct timezone' whose tz_minuteswest and tz_dsttime fields are zero. (For efficiency reasons, this does not always happen on a few Linux-based ports. This will be corrected in a future release.)
All callers should supply a null pointer for the 'tzp' argument to gettimeofday. For accurate information about the time zone associated with the current time, use the localtime function.
gettimeofday itself is obsolescent according to POSIX. We have no plans to remove access to this function, but portable programs should consider using clock_gettime instead.
Changing the second parameter of the gettimeofday
overload to void *__restrict tzp
will fix it for glibc-2.31+
I encountered the same problem with Fedora 32 today!
Best Martin
As pointed out by @SjonHortensius builds can be possible with
diff --git a/src/detime.c b/src/detime.c
index 441b584..5c9a8ce 100644
--- a/src/detime.c
+++ b/src/detime.c
@@ -21,9 +21,9 @@ time_t time(time_t *res)
}
#ifdef __unix__
-int gettimeofday(struct timeval *tv, struct timezone *tz)
+int gettimeofday(struct timeval *tv, void *__restrict tzp)
{
-
+ struct timezone *tz = (struct timezone *) tzp;
char *sec_str = getenv("TV_SEC");
char *usec_str = getenv("TV_USEC");
tv->tv_sec = sec_str ? atoi(sec_str) : 0;
But since now gettimeofday
will always zero the struct if tzp
is non null, from release/2.31/master
/* Get the current time of day, putting it into *TV.
If *TZ is not NULL, clear it.
Returns 0 on success, -1 on errors. */
int
___gettimeofday (struct timeval *restrict tv, void *restrict tz)
{
if (__glibc_unlikely (tz != 0))
memset (tz, 0, sizeof (struct timezone));
struct timespec ts;
if (__clock_gettime (CLOCK_REALTIME, &ts))
return -1;
TIMESPEC_TO_TIMEVAL (tv, &ts);
return 0;
}
Should we get preeny to reflect that for newer builds?
Build fails on Arch Linux:
Thanks in advance!