diff options
Diffstat (limited to 'networking')
| -rw-r--r-- | networking/ntpd.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/networking/ntpd.c b/networking/ntpd.c index dd0a9c91f..efe9f5326 100644 --- a/networking/ntpd.c +++ b/networking/ntpd.c | |||
| @@ -1645,7 +1645,7 @@ update_local_clock(peer_t *p) | |||
| 1645 | /* 65536 is one ppm */ | 1645 | /* 65536 is one ppm */ |
| 1646 | tmx.freq = G.discipline_freq_drift * 65536e6; | 1646 | tmx.freq = G.discipline_freq_drift * 65536e6; |
| 1647 | #endif | 1647 | #endif |
| 1648 | tmx.modes = ADJ_OFFSET | ADJ_STATUS | ADJ_TIMECONST;// | ADJ_MAXERROR | ADJ_ESTERROR; | 1648 | tmx.modes = ADJ_OFFSET | ADJ_STATUS | ADJ_TIMECONST | ADJ_MAXERROR | ADJ_ESTERROR; |
| 1649 | 1649 | ||
| 1650 | tmx.offset = (long)(offset * 1000000); /* usec */ | 1650 | tmx.offset = (long)(offset * 1000000); /* usec */ |
| 1651 | if (SLEW_THRESHOLD < STEP_THRESHOLD) { | 1651 | if (SLEW_THRESHOLD < STEP_THRESHOLD) { |
| @@ -1738,16 +1738,23 @@ update_local_clock(peer_t *p) | |||
| 1738 | if (tmx.constant < 0) | 1738 | if (tmx.constant < 0) |
| 1739 | tmx.constant = 0; | 1739 | tmx.constant = 0; |
| 1740 | 1740 | ||
| 1741 | //tmx.esterror = (uint32_t)(clock_jitter * 1e6); | 1741 | /* For ADJ_MAXERROR and ADJ_ESTERROR: */ |
| 1742 | //tmx.maxerror = (uint32_t)((sys_rootdelay / 2 + sys_rootdisp) * 1e6); | 1742 | /* kernel increments this by 500us each second, sets STA_UNSYNC if exceeds 16 seconds: */ |
| 1743 | tmx.maxerror = (uint32_t)((G.rootdelay / 2 + G.rootdisp) * 1000000.0); | ||
| 1744 | /* (without ADJ_MAXERROR, time adjustment still works, but kernel uses | ||
| 1745 | * conservative maxerror value and quickly sets STA_UNSYNC) | ||
| 1746 | */ | ||
| 1747 | /* esterror is not used by kernel, presumably may be used by other programs reading adjtimex result: */ | ||
| 1748 | tmx.esterror = (uint32_t)(G.discipline_jitter * 1000000.0); | ||
| 1749 | |||
| 1743 | rc = adjtimex(&tmx); | 1750 | rc = adjtimex(&tmx); |
| 1744 | if (rc < 0) | 1751 | if (rc < 0) |
| 1745 | bb_simple_perror_msg_and_die("adjtimex"); | 1752 | bb_simple_perror_msg_and_die("adjtimex"); |
| 1746 | /* NB: here kernel returns constant == G.poll_exp, not == G.poll_exp - 4. | 1753 | /* NB: here kernel returns constant == G.poll_exp, not == G.poll_exp - 4. |
| 1747 | * Not sure why. Perhaps it is normal. | 1754 | * Not sure why. Perhaps it is normal. |
| 1748 | */ | 1755 | */ |
| 1749 | VERB4 bb_error_msg("adjtimex:%d freq:%ld offset:%+ld status:0x%x", | 1756 | VERB4 bb_error_msg("adjtimex:%d freq:%ld offset:%+ld esterror:%ld maxerror:%ld status:0x%x", |
| 1750 | rc, (long)tmx.freq, (long)tmx.offset, tmx.status); | 1757 | rc, (long)tmx.freq, (long)tmx.offset, (long)tmx.esterror, (long)tmx.maxerror, tmx.status); |
| 1751 | G.kernel_freq_drift = tmx.freq / 65536; | 1758 | G.kernel_freq_drift = tmx.freq / 65536; |
| 1752 | VERB2 bb_error_msg("update from:%s offset:%+f delay:%f jitter:%f clock drift:%+.3fppm tc:%d", | 1759 | VERB2 bb_error_msg("update from:%s offset:%+f delay:%f jitter:%f clock drift:%+.3fppm tc:%d", |
| 1753 | p->p_dotted, | 1760 | p->p_dotted, |
