Browse Source

experimental time sync bits, see #25

OPENBSD_6_0
Brent Cook 8 years ago
parent
commit
b1cbf2c14a
4 changed files with 21 additions and 4 deletions
  1. +4
    -1
      compat/adjfreq_freebsd.c
  2. +4
    -1
      compat/adjfreq_linux.c
  3. +4
    -1
      compat/adjfreq_netbsd.c
  4. +9
    -1
      compat/adjfreq_solaris.c

+ 4
- 1
compat/adjfreq_freebsd.c View File

@ -68,7 +68,10 @@ update_time_sync_status(int synced)
struct timex txc = { 0 };
txc.modes = MOD_STATUS;
if (!synced)
if (synced) {
txc.modes |= MOD_MAXERROR;
txc.maxerror = 0;
} else
txc.status = STA_UNSYNC;
if (ntp_adjtime(&txc) == -1)
log_warn("ntp_adjtime (3) failed");


+ 4
- 1
compat/adjfreq_linux.c View File

@ -68,7 +68,10 @@ update_time_sync_status(int synced)
struct timex txc = { 0 };
txc.modes = MOD_STATUS;
if (!synced)
if (synced) {
txc.modes |= MOD_MAXERROR;
txc.maxerror = 0;
} else
txc.status = STA_UNSYNC;
if (adjtimex(&txc) == -1)
log_warn("ntp_adjtime (3) failed");


+ 4
- 1
compat/adjfreq_netbsd.c View File

@ -69,7 +69,10 @@ update_time_sync_status(int synced)
struct timex txc = { 0 };
txc.modes = MOD_STATUS;
if (!synced)
if (synced) {
txc.modes |= MOD_MAXERROR;
txc.maxerror = 0;
} else
txc.status = STA_UNSYNC;
if (ntp_adjtime(&txc) == -1)
log_warn("ntp_adjtime (3) failed");


+ 9
- 1
compat/adjfreq_solaris.c View File

@ -68,8 +68,16 @@ update_time_sync_status(int synced)
struct timex txc = { 0 };
txc.modes = MOD_STATUS;
if (!synced)
if (synced) {
txc.modes |= MOD_MAXERROR;
txc.maxerror = 0;
} else
txc.status = STA_UNSYNC;
/*
* Cargo-cult MOD_TIMECONST value from chrony for a Solaris kernel
* quirk. The kernel possibly always checks this constant.
*/
txc.constant = 10;
if (ntp_adjtime(&txc) == -1)
log_warn("ntp_adjtime (3) failed");
return;


Loading…
Cancel
Save