royhills / arp-scan

The ARP Scanner
GNU General Public License v3.0
977 stars 154 forks source link

Replace the obsolete gettimeofday() with the higher precision clock_gettime() #187

Open royhills opened 3 months ago

royhills commented 3 months ago

Per https://pubs.opengroup.org/onlinepubs/9699919799/functions/gettimeofday.html, the gettimeofday() will be removed in a future POSIX.1 spec and should be replaced with clock_gettime().

The issue 7 of POSIX.1 has recently been released, and this has moved gettimeofday() to obsolescent status: https://pubs.opengroup.org/onlinepubs/9699919799/xrat/V4_xsh_chap01.html

We should replace uses of gettimeofday() with clock_gettime() assuming this is supported on all distros.

clock_gettime() uses struct timespec (seconds and nanoseconds) rather than the struct timeval (seconds and microseconds) used by gettimeofday().

select() should be replaced with pselect().