Lines 15-21
Link Here
|
15 |
*/ |
15 |
*/ |
16 |
|
16 |
|
17 |
#include <sys/types.h> |
17 |
#include <sys/types.h> |
18 |
# include <sys/timex.h> |
18 |
#include <sys/timex.h> |
19 |
|
19 |
|
20 |
#include <unistd.h> |
20 |
#include <unistd.h> |
21 |
|
21 |
|
Lines 37-56
adjfreq(const int64_t *freq, int64_t *oldfreq)
Link Here
|
37 |
txc.modes = ADJ_FREQUENCY; |
37 |
txc.modes = ADJ_FREQUENCY; |
38 |
txc.freq = *freq / 1e3 / (1LL << 16); |
38 |
txc.freq = *freq / 1e3 / (1LL << 16); |
39 |
|
39 |
|
40 |
if ((ntp_adjtime(&txc)) == -1) |
40 |
if ((adjtimex(&txc)) == -1) |
41 |
log_warn("ntp_adjtime (2) failed"); |
41 |
log_warn("adjtimex failed"); |
42 |
|
42 |
|
43 |
log_debug("ntp_adjtime adjusted frequency by %fppm", |
43 |
log_debug("adjtimex adjusted frequency by %fppm", |
44 |
((txc.freq * 1e3) * (1LL<<16) / 1e3 / (1LL << 32))); |
44 |
((txc.freq * 1e3) * (1LL<<16) / 1e3 / (1LL << 32))); |
45 |
} |
45 |
} |
46 |
if (oldfreq != NULL) { |
46 |
if (oldfreq != NULL) { |
47 |
txc.modes = 0; |
47 |
txc.modes = 0; |
48 |
if ((ntp_adjtime(&txc)) == -1) { |
48 |
if ((adjtimex(&txc)) == -1) { |
49 |
log_warn("ntp_adjtime (1) failed"); |
49 |
log_warn("adjtimex failed"); |
50 |
return -1; |
50 |
return -1; |
51 |
} |
51 |
} |
52 |
newfreq = (txc.freq * 1e3) * (1LL<<16); |
52 |
newfreq = (txc.freq * 1e3) * (1LL<<16); |
53 |
log_debug("ntp_adjtime returns frequency of %fppm", |
53 |
log_debug("adjtimex returns frequency of %fppm", |
54 |
newfreq / 1e3 / (1LL << 32)); |
54 |
newfreq / 1e3 / (1LL << 32)); |
55 |
*oldfreq = newfreq; |
55 |
*oldfreq = newfreq; |
56 |
} |
56 |
} |