diff options
author | Martin Burnicki <martin.burnicki@meinberg.de> | 2018-04-09 12:00:00 +0200 |
---|---|---|
committer | Martin Burnicki <martin.burnicki@meinberg.de> | 2018-04-09 12:00:00 +0200 |
commit | 6b78f35618249cc4cd82f68ee868b7758145b0a1 (patch) | |
tree | 0c30ea1ac1e6a4b7029f50776948abcba8476bcf | |
parent | 8af775dc00e14dc74e7cd74dc202cec636efbddd (diff) | |
download | ntptest-6b78f35618249cc4cd82f68ee868b7758145b0a1.tar.gz ntptest-6b78f35618249cc4cd82f68ee868b7758145b0a1.zip |
Don't print min/max results after a single query1.9
-rwxr-xr-x | README | 58 | ||||
-rwxr-xr-x | mbglib/common/mbgntp.c | 8 | ||||
-rwxr-xr-x | ntptest.c | 10 |
3 files changed, 40 insertions, 36 deletions
@@ -1,6 +1,5 @@ -$Id: README 1.3 2016/08/05 12:54:04 martin REL_M $ -This is the README file for the ntptest tool which is similar to ntpdate +This is the README file for the "ntptest" tool that is similar to ntpdate which comes with the NTP software package. It sends an NTP request packet to an NTP server, receives the response packet, and evaluates the returned information. @@ -13,49 +12,48 @@ in 1 line. This is useful e.g. for leap second monitoring of remote devices. To build the executable under Linux just unpack the tar.gz source code archive, cd into the unix/ directory below the extracted directory, and run "make". +Then type "./ntptest -?" to get some usage information. -For Windows there is a project file for Visual Studion 2008 in the windows\vs2008 -directory. +For Windows there is a project file for Visual Studio 2008 in the windows\vs2008 +directory. Build the solution, then run the compiled binary "ntptest -?" to get +some usage information. -Then type "./ntptest -?" to get some usage information. At least the hostname or IP address of a remote NTP server has to be specified on the command line, e.g.: ------------------------------------------------------------------------------ -#ntptest> ./ntptest 172.16.100.43 +#ntptest> ./ntptest 172.16.100.110 -ntptest v1.3, (c) Meinberg 2014-2016, contact: <martin.burnicki@meinberg.de> +ntptest v1.9, (c) Meinberg 2014-2018, contact: <martin.burnicki@meinberg.de> -Host 172.16.100.43 +Host 172.16.100.110 Request packet: - mode 3, version 4, leap_ind 3, stratum 0, poll 6, prec -18 (3.81 us) - root delay: 00000000 (0.0000 s) - root dispersion: 00000000 (0.0000 s/s) - reference id: 00000000 () + mode 3, version 4, leap 3, stratum 0, poll 6, prec -18 (3.81 us) + root delay: 00000000 (0.000000 s) + root dispersion: 00000000 (0.000000 s/s) + reference id: 00000000 ("....") Ref time: 00000000.00000000 1900-01-01 00:00:00.000000000 Org time (T1): 00000000.00000000 1900-01-01 00:00:00.000000000 Rcv time (T2): 00000000.00000000 1900-01-01 00:00:00.000000000 - Xmt time (T3): DB4F094D.CBB95E8A 2016-08-05 12:47:09.795797260 - Curr time (T4): DB4F094D.CBB95E8A 2016-08-05 12:47:09.795797260 + Xmt time (T3): DE75990D.27C6F26D 2018-04-09 07:47:25.155379439 + Curr time (T4): DE75990D.27C6F26D 2018-04-09 07:47:25.155379439 Response packet: - mode 4, version 4, leap_ind 0, stratum 1, poll 6, prec -18 (3.81 us) - root delay: 00000000 (0.0000 s) - root dispersion: 00000046 (0.0011 s/s) - reference id: 0053524D (MRS) - Ref time: DB4F0949.096E2ED8 2016-08-05 12:47:05.036837508 - Org time (T1): DB4F094D.CBB95E8A 2016-08-05 12:47:09.795797260 - Rcv time (T2): DB4F094D.CBA1359C 2016-08-05 12:47:09.795428610 - Xmt time (T3): DB4F094D.CBB5D7CF 2016-08-05 12:47:09.795743454 - Curr time (T4): DB4F094D.CBD81EA0 2016-08-05 12:47:09.796266473 - -Authentication: not used - -turnaround: 469.213 (469.213..469.213) us (T4 - T1) -server latency: 314.844 (314.844..314.844) us (T3 - T2) -computed delay: 154.369 (154.369..154.369) us ((T4 - T1) - (T3 - T2)) -computed offset: -445.835 (-445.835..-445.835) us (((T2 - T1) + (T3 - T4)) / 2) + mode 4, version 4, leap 0, stratum 1, poll 6, prec -18 (3.81 us) + root delay: 00000000 (0.000000 s) + root dispersion: 00000048 (0.001099 s/s) + reference id: 0053524D ("MRS.") + Ref time: DE759906.0961A292 2018-04-09 07:47:18.036646042 + Org time (T1): DE75990D.27C6F26D 2018-04-09 07:47:25.155379439 + Rcv time (T2): DE75990D.27C6366F 2018-04-09 07:47:25.155368234 + Xmt time (T3): DE75990D.27E9F68F 2018-04-09 07:47:25.155913743 + Curr time (T4): DE75990D.27FDB675 2018-04-09 07:47:25.156215098 + +turnaround: 835.659 us (T4 - T1) +server latency: 545.509 us (T3 - T2) +computed delay: 290.150 us ((T4 - T1) - (T3 - T2)) +computed offset: -156.280 us (((T2 - T1) + (T3 - T4)) / 2) ------------------------------------------------------------------------------ The output shows the contents of the request packet sent to the NTP server, diff --git a/mbglib/common/mbgntp.c b/mbglib/common/mbgntp.c index 007a048..fa4c3de 100755 --- a/mbglib/common/mbgntp.c +++ b/mbglib/common/mbgntp.c @@ -1,7 +1,7 @@ /************************************************************************** * - * $Id: mbgntp.c 1.1 2018/03/09 09:56:35 martin REL_M $ + * $Id: mbgntp.c 1.2 2018/04/09 07:30:22 martin REL_M $ * * Copyright (c) Meinberg Funkuhren, Bad Pyrmont, Germany * @@ -10,7 +10,9 @@ * * ----------------------------------------------------------------------- * $Log: mbgntp.c $ - * Revision 1.1 2018/03/09 09:56:35 martin + * Revision 1.2 2018/04/09 07:30:22 martin + * Fixed a compiler warning. + * Revision 1.1 2018/03/09 09:56:35Z martin * Initial revision. * **************************************************************************/ @@ -108,7 +110,7 @@ int snprint_ntp_prec( char *s, size_t max_len, int8_t prec_exp ) int snprintf_ntp_refid_as_text( char *s, size_t max_len, const NTP_REFID *p ) { char *cp = s; - int i; + size_t i; for ( i = 0; i < sizeof( *p ) && i < max_len; i++ ) { @@ -1,7 +1,7 @@ /************************************************************************** * - * $Id: ntptest.c 1.12 2018/03/09 09:59:29 martin REL_M $ + * $Id: ntptest.c 1.13 2018/03/29 12:18:05 martin REL_M $ * * Copyright (c) Meinberg Funkuhren, Bad Pyrmont, Germany * @@ -12,6 +12,9 @@ * * ----------------------------------------------------------------------- * $Log: ntptest.c $ + * Revision 1.13 2018/03/29 12:18:05 martin + * Don't print min/max results after single query. + * Changed version number to 1.9. * Revision 1.12 2018/03/09 09:59:29 martin * Updated version number to 1.8 and copyright year to 2018. * Revision 1.11 2017/09/06 14:26:59 martin @@ -72,7 +75,7 @@ static const char program_name[] = "ntptest"; -static const char program_version[] = "v1.8"; +static const char program_version[] = "v1.9"; static const char program_copyright[] = "(c) Meinberg 2014-2018"; static const char program_contact[] = "contact: <martin.burnicki@meinberg.de>"; @@ -238,7 +241,8 @@ void do_ntp_queries( void ) ntoh_ntp_packet( &req_info ); if ( print_packets ) - print_ntp_results( &rslt, &req_info, &reply_info, &glb_query_stats, 1, verbose ); + print_ntp_results( &rslt, &req_info, &reply_info, + run_continuously ? &glb_query_stats : NULL, 1, verbose ); else { NTP_PACKET *p = &reply_info.packet; |