Browse Source

prefer adjtimex over the deprecated ntp_adjtime on Linux

Thanks to @chneukirchen for the suggestion.
OPENBSD_5_7
Brent Cook 9 years ago
parent
commit
eeb97529cd
1 changed files with 7 additions and 7 deletions
  1. +7
    -7
      compat/adjfreq_linux.c

+ 7
- 7
compat/adjfreq_linux.c View File

@ -15,7 +15,7 @@
*/
#include <sys/types.h>
# include <sys/timex.h>
#include <sys/timex.h>
#include <unistd.h>
@ -37,20 +37,20 @@ adjfreq(const int64_t *freq, int64_t *oldfreq)
txc.modes = ADJ_FREQUENCY;
txc.freq = *freq / 1e3 / (1LL << 16);
if ((ntp_adjtime(&txc)) == -1)
log_warn("ntp_adjtime (2) failed");
if ((adjtimex(&txc)) == -1)
log_warn("adjtimex failed");
log_debug("ntp_adjtime adjusted frequency by %fppm",
log_debug("adjtimex adjusted frequency by %fppm",
((txc.freq * 1e3) * (1LL<<16) / 1e3 / (1LL << 32)));
}
if (oldfreq != NULL) {
txc.modes = 0;
if ((ntp_adjtime(&txc)) == -1) {
log_warn("ntp_adjtime (1) failed");
if ((adjtimex(&txc)) == -1) {
log_warn("adjtimex failed");
return -1;
}
newfreq = (txc.freq * 1e3) * (1LL<<16);
log_debug("ntp_adjtime returns frequency of %fppm",
log_debug("adjtimex returns frequency of %fppm",
newfreq / 1e3 / (1LL << 32));
*oldfreq = newfreq;
}


Loading…
Cancel
Save