blob: 6141f25cdd6f70786a3ed0763a7335cae247882d (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
/*
* This file is in the public domain.
*
* $FreeBSD$
*/
#include <sys/types.h>
#include <sys/timex.h>
#include "ntpd.h"
int
adjfreq(const int64_t *freq, int64_t *oldfreq)
{
struct timex t;
if (oldfreq) {
t.modes = 0;
if (ntp_adjtime(&t) == -1)
return -1;
*oldfreq = (int64_t)t.freq * (1<<16) * 1000;
}
if (freq) {
t.modes = MOD_FREQUENCY;
t.freq = *freq / ((1<<16) * 1000);
if (ntp_adjtime(&t) == -1)
return -1;
}
return 0;
}
|