client: add smoothing command
This commit is contained in:
parent
fb9c2c7dc8
commit
41788184a7
2 changed files with 89 additions and 0 deletions
|
@ -3284,6 +3284,7 @@ password:
|
||||||
@item @code{password}
|
@item @code{password}
|
||||||
@item @code{quit}
|
@item @code{quit}
|
||||||
@item @code{rtcdata}
|
@item @code{rtcdata}
|
||||||
|
@item @code{smoothing}
|
||||||
@item @code{sources}
|
@item @code{sources}
|
||||||
@item @code{sourcestats}
|
@item @code{sourcestats}
|
||||||
@item @code{tracking}
|
@item @code{tracking}
|
||||||
|
@ -3344,6 +3345,7 @@ interface.
|
||||||
* retries command:: Set maximum number of retries
|
* retries command:: Set maximum number of retries
|
||||||
* rtcdata command:: Display RTC parameters
|
* rtcdata command:: Display RTC parameters
|
||||||
* settime command:: Provide a manual input of the current time
|
* settime command:: Provide a manual input of the current time
|
||||||
|
* smoothing command:: Display current time smoothing state
|
||||||
* sources command:: Display information about the current set of sources
|
* sources command:: Display information about the current set of sources
|
||||||
* sourcestats command:: Display the rate & offset estimation performance of sources
|
* sourcestats command:: Display the rate & offset estimation performance of sources
|
||||||
* timeout command:: Set initial response timeout
|
* timeout command:: Set initial response timeout
|
||||||
|
@ -4321,6 +4323,51 @@ settime Nov 21, 1997 16:30:05
|
||||||
For a full description of @code{getdate}, get hold of the getdate
|
For a full description of @code{getdate}, get hold of the getdate
|
||||||
documentation (bundled, for example, with the source for GNU tar).
|
documentation (bundled, for example, with the source for GNU tar).
|
||||||
@c }}}
|
@c }}}
|
||||||
|
@c {{{ smoothing
|
||||||
|
@node smoothing command
|
||||||
|
@subsubsection smoothing
|
||||||
|
The @code{smoothing} command displays the current state of the NTP server time
|
||||||
|
smoothing. An example of the output is shown below.
|
||||||
|
|
||||||
|
@example
|
||||||
|
Active : Yes
|
||||||
|
Offset : +1.000268817 seconds
|
||||||
|
Frequency : -0.142859 ppm
|
||||||
|
Wander : -0.010000 ppm per second
|
||||||
|
Last update : 17.8 seconds ago
|
||||||
|
Remaining time : 19988.4 seconds
|
||||||
|
@end example
|
||||||
|
|
||||||
|
The fields are explained as follows.
|
||||||
|
|
||||||
|
@table @code
|
||||||
|
@item Active
|
||||||
|
This shows if the server time smoothing is currently active. Possible values
|
||||||
|
are @code{Yes} and @code{No}. If the @code{leaponly} option is included in the
|
||||||
|
@code{smoothtime} directive, @code{(leap second only)} will be shown on the
|
||||||
|
line.
|
||||||
|
|
||||||
|
@item Offset
|
||||||
|
This is the current offset applied to the time sent to NTP clients. Positive
|
||||||
|
value means the clients are getting time that's ahead of true time.
|
||||||
|
|
||||||
|
@item Frequency
|
||||||
|
The current frequency offset of the served time. Negative value means the time
|
||||||
|
observed by clients is running slower than true time.
|
||||||
|
|
||||||
|
@item Wander
|
||||||
|
The current frequency wander of the served time. Negative value means the time
|
||||||
|
observed by clients is slowing down.
|
||||||
|
|
||||||
|
@item Last update
|
||||||
|
This field shows how long ago was the time smoothing process updated, e.g.
|
||||||
|
@code{chronyd} accumulated a new measurement.
|
||||||
|
|
||||||
|
@item Remaining time
|
||||||
|
The time it would take for the smoothing process to get to zero offset and
|
||||||
|
frequency if there were no more updates.
|
||||||
|
@end table
|
||||||
|
@c }}}
|
||||||
@c {{{ sources
|
@c {{{ sources
|
||||||
@node sources command
|
@node sources command
|
||||||
@subsubsection sources
|
@subsubsection sources
|
||||||
|
|
42
client.c
42
client.c
|
@ -1184,6 +1184,7 @@ give_help(void)
|
||||||
printf("reselect : Reselect synchronisation source\n");
|
printf("reselect : Reselect synchronisation source\n");
|
||||||
printf("rtcdata : Print current RTC performance parameters\n");
|
printf("rtcdata : Print current RTC performance parameters\n");
|
||||||
printf("settime <date/time (e.g. Nov 21, 1997 16:30:05 or 16:30:05)> : Manually set the daemon time\n");
|
printf("settime <date/time (e.g. Nov 21, 1997 16:30:05 or 16:30:05)> : Manually set the daemon time\n");
|
||||||
|
printf("smoothing : Display current time smoothing state\n");
|
||||||
printf("sources [-v] : Display information about current sources\n");
|
printf("sources [-v] : Display information about current sources\n");
|
||||||
printf("sourcestats [-v] : Display estimation information about current sources\n");
|
printf("sourcestats [-v] : Display estimation information about current sources\n");
|
||||||
printf("tracking : Display system time information\n");
|
printf("tracking : Display system time information\n");
|
||||||
|
@ -1964,6 +1965,44 @@ process_cmd_tracking(char *line)
|
||||||
}
|
}
|
||||||
/* ================================================== */
|
/* ================================================== */
|
||||||
|
|
||||||
|
static int
|
||||||
|
process_cmd_smoothing(char *line)
|
||||||
|
{
|
||||||
|
CMD_Request request;
|
||||||
|
CMD_Reply reply;
|
||||||
|
uint32_t flags;
|
||||||
|
double offset;
|
||||||
|
double freq_ppm;
|
||||||
|
double wander_ppm;
|
||||||
|
double last_update_ago;
|
||||||
|
double remaining_time;
|
||||||
|
|
||||||
|
request.command = htons(REQ_SMOOTHING);
|
||||||
|
|
||||||
|
if (request_reply(&request, &reply, RPY_SMOOTHING, 0)) {
|
||||||
|
flags = ntohl(reply.data.smoothing.flags);
|
||||||
|
offset = UTI_FloatNetworkToHost(reply.data.smoothing.offset);
|
||||||
|
freq_ppm = UTI_FloatNetworkToHost(reply.data.smoothing.freq_ppm);
|
||||||
|
wander_ppm = UTI_FloatNetworkToHost(reply.data.smoothing.wander_ppm);
|
||||||
|
last_update_ago = UTI_FloatNetworkToHost(reply.data.smoothing.last_update_ago);
|
||||||
|
remaining_time = UTI_FloatNetworkToHost(reply.data.smoothing.remaining_time);
|
||||||
|
|
||||||
|
printf("Active : %s%s\n",
|
||||||
|
flags & RPY_SMT_FLAG_ACTIVE ? "Yes" : "No",
|
||||||
|
flags & RPY_SMT_FLAG_LEAPONLY ? " (leap second only)" : "");
|
||||||
|
printf("Offset : %+.9f seconds\n", offset);
|
||||||
|
printf("Frequency : %+.6f ppm\n", freq_ppm);
|
||||||
|
printf("Wander : %+.6f ppm per second\n", wander_ppm);
|
||||||
|
printf("Last update : %.1f seconds ago\n", last_update_ago);
|
||||||
|
printf("Remaining time : %.1f seconds\n", remaining_time);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ================================================== */
|
||||||
|
|
||||||
static int
|
static int
|
||||||
process_cmd_rtcreport(char *line)
|
process_cmd_rtcreport(char *line)
|
||||||
{
|
{
|
||||||
|
@ -2535,6 +2574,9 @@ process_line(char *line, int *quit)
|
||||||
} else if (!strcmp(command, "settime")) {
|
} else if (!strcmp(command, "settime")) {
|
||||||
do_normal_submit = 0;
|
do_normal_submit = 0;
|
||||||
ret = process_cmd_settime(line);
|
ret = process_cmd_settime(line);
|
||||||
|
} else if (!strcmp(command, "smoothing")) {
|
||||||
|
do_normal_submit = 0;
|
||||||
|
ret = process_cmd_smoothing(line);
|
||||||
} else if (!strcmp(command, "sources")) {
|
} else if (!strcmp(command, "sources")) {
|
||||||
do_normal_submit = 0;
|
do_normal_submit = 0;
|
||||||
ret = process_cmd_sources(line);
|
ret = process_cmd_sources(line);
|
||||||
|
|
Loading…
Reference in a new issue