[atlas] RIPE Atlas Software Probes and Ubuntu 20.04 / glibc 2.31
- Previous message (by thread): [atlas] running a probe via LTE access
- Next message (by thread): [atlas] anchor on a /32 network with on-link routing ?
Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Bernd Strehhuber
Bernd.Strehhuber at planb.de
Sun May 24 13:04:07 CEST 2020
Hi Philip, with newer Linux Dists / glibc Versions (tested on Ubuntu 20.04 LTS) stime() has been deprecated and replaced with clock_settime(). Busybox got the following commit back in 11/2019: https://git.busybox.net/busybox/commit/?id=d3539be8f27b8cbfdfee460fe08299158f08bcd9 Compiling on the latest Ubuntu version I applied the attached diff to get things working again. Bye Bernd -- plan b. solutions GmbH Baumeisterstrasse 50, 76137 Karlsruhe, Germany phone: +49 721 388582, fax: +49 721 388581, mailto: info at planb.de CEO: Bernd Strehhuber, registration court: AG Mannheim HRB 701718 -------------- next part -------------- diff --git a/coreutils/date.c b/coreutils/date.c index b016656..99b7578 100644 --- a/coreutils/date.c +++ b/coreutils/date.c @@ -269,6 +269,9 @@ int date_main(int argc UNUSED_PARAM, char **argv) time(&ts.tv_sec); #endif } +#if !ENABLE_FEATURE_DATE_NANO + ts.tv_nsec = 0; +#endif localtime_r(&ts.tv_sec, &tm_time); /* If date string is given, update tm_time, and maybe set date */ @@ -305,12 +308,13 @@ int date_main(int argc UNUSED_PARAM, char **argv) if (date_str[0] != '@') tm_time.tm_isdst = -1; ts.tv_sec = validate_tm_time(date_str, &tm_time); + ts.tv_nsec = 0; maybe_set_utc(opt); } /* if setting time, set it */ - if ((opt & OPT_SET) && stime(&ts.tv_sec) < 0) { + if ((opt & OPT_SET) && clock_settime(CLOCK_REALTIME, &ts) < 0) { bb_perror_msg("can't set date"); } } diff --git a/libbb/missing_syscalls.c b/libbb/missing_syscalls.c index 0934128..65709ed 100644 --- a/libbb/missing_syscalls.c +++ b/libbb/missing_syscalls.c @@ -16,14 +16,6 @@ pid_t getsid(pid_t pid) return syscall(__NR_getsid, pid); } -int stime(const time_t *t) -{ - struct timeval tv; - tv.tv_sec = *t; - tv.tv_usec = 0; - return settimeofday(&tv, NULL); -} - int sethostname(const char *name, size_t len) { return syscall(__NR_sethostname, name, len); diff --git a/networking/httpget.c b/networking/httpget.c index 74889ea..3221dbd 100644 --- a/networking/httpget.c +++ b/networking/httpget.c @@ -975,7 +975,7 @@ static int eat_headers(FILE *tcp_file, int *chunked, int *content_length, "setting time, time difference is %d\n", (int)(tim-now)); } - stime(&tim); + clock_settime(CLOCK_REALTIME,&tim); } } diff --git a/networking/httppost.c b/networking/httppost.c index 93ccfb1..cb4179e 100644 --- a/networking/httppost.c +++ b/networking/httppost.c @@ -493,7 +493,7 @@ int httppost_main(int argc, char *argv[]) fprintf(stderr, "setting time, time difference is %ld\n", (long)server_time-now.tv_sec); - stime(&server_time); + clock_settime(CLOCK_REALTIME,&server_time); if (atlas_id) { printf( diff --git a/util-linux/rdate.c b/util-linux/rdate.c index 8dd784d..d38f676 100644 --- a/util-linux/rdate.c +++ b/util-linux/rdate.c @@ -79,9 +79,13 @@ int rdate_main(int argc UNUSED_PARAM, char **argv) time(¤t_time); if (current_time == remote_time) bb_error_msg("current time matches remote time"); - else - if (stime(&remote_time) < 0) + else { + struct timespec ts; + ts.tv_sec = remote_time; + ts.tv_nsec = 0; + if (clock_settime(CLOCK_REALTIME, &ts) < 0) bb_perror_msg_and_die("can't set time of day"); + } } if (flags != 1) /* not lone -s */
- Previous message (by thread): [atlas] running a probe via LTE access
- Next message (by thread): [atlas] anchor on a /32 network with on-link routing ?
Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]