]> git.ozlabs.org Git - ppp.git/commit - pppd/plugins/rp-pppoe/discovery.c
pppd: linux: use monotonic time if possible
authorVladislav Grishenko <themiron@mail.ru>
Wed, 15 Aug 2018 17:03:45 +0000 (22:03 +0500)
committerVladislav Grishenko <themiron@mail.ru>
Fri, 22 May 2020 07:53:20 +0000 (12:53 +0500)
commitc78e3129d404f20d556f727ceee3704722de8cc7
treeddc4fd9257dff95cc885ac4aa5d6b05aeabdbfe7
parent347904e33a8a1993316e57445a1ba8243cd947ce
pppd: linux: use monotonic time if possible

gettimeofday() suffers from time jumps due ntp or any manual change,
so duration measurements and scheduling can not be accurate.
let's use monotonic time source instead, if available.

it's known glibc (< 2.3.4) & old uclibc don't provide CLOCK_MONOTONIC
denine, but kernel may have it supported. so, use clock_gettime()
with fallback to gettimeofday() if first call has failed.

several gettimeofday()/time() calls still have to be preserved for
debug, pseudoterminal timestamping and string formatting. all the
rest calls are replaced to new get_time() call.

solaris kept with gettimeofday() as before, corresponding get_time()
system implementation can be updated/added in any future.

Signed-off-by: Vladislav Grishenko <themiron@mail.ru>
pppd/Makefile.linux
pppd/main.c
pppd/plugins/radius/buildreq.c
pppd/plugins/rp-pppoe/discovery.c
pppd/pppd.h
pppd/sys-linux.c
pppd/sys-solaris.c
pppd/tty.c