sntp

Network Time Protocol client

sntp [-drSs] [-g milliseconds] [-t seconds] host-name|IP
-d Enable debug logging.
-g milliseconds Gap betwen requests in milliseconds.
-n number Number of DNS records to use for each host argument. This does not have to be less than, equal to, or greater than the number of records that any host lookup returns. Numbers smaller than the number of records will fetch only that many records. Numbers larger than the number of records will fetch some records more than once, as required, to reach the number of fetches desired.
-r bind(2) the NTP reserved port (123) for source communications.
-S Use clock_settime(2) to set the system clock if the offset is greater than 50 milliseconds, or -s is not specified.
-s Use adjtime(2) to slew the system clock if the offset is less than 50 milliseconds.
-t seconds Maximum number of seconds to wait for responses.
-z path Path to dump header state to. This is useful for sntpd(8) to read from. Header data is stored on disk in big- endian (NBO) format.

USAGE

sntp pool.ntp.org
sudo sntp -s pool.ntp.org
> sntp -d pool.ntp.org
sntp_exchange {
        result: 0 (Success)
        header: 24 (li:0 vn:4 mode:4)
       stratum: 03 (3)
          poll: 03 (8)
     precision: FFFFFFE9 (1.192093e-07)
         delay: 0000.0444 (0.016662598)
    dispersion: 0000.0EB8 (0.057495117)
           ref: 2C18C722 (34.199.24.44)
         t_ref: E69EB51E.ADB76344 (3869160734.678579525)
            t1: E69EBB04.048CC575 (3869162244.017772999)
            t2: E69EBB06.43D862BC (3869162246.265020533)
            t3: E69EBB06.43DA140D (3869162246.265046361)
            t4: E69EBB04.1B605AB3 (3869162244.106938999)
        offset: 0000000000000002.33E2AB5080000000 (2.202677447)
         delay: 0000000000000000.16D1E3ED00000000 (0.089140172)
          mean: 00000000E69EBB06.43D93B6480000000 (3869162246.265033245)
         error: 0000000000000000.10DA000000000000 (0.065826416)
          addr: 204.2.134.163
}
sntp_exchange {
        result: 0 (Success)
        header: 24 (li:0 vn:4 mode:4)
       stratum: 02 (2)
          poll: 03 (8)
     precision: FFFFFFE8 (5.960464e-08)
         delay: 0000.0AA1 (0.041519165)
    dispersion: 0000.0520 (0.020019531)
           ref: D9B4D1D5 (213.209.180.217)
         t_ref: E69EBA4E.773B4B1D (3869162062.465748495)
            t1: E69EBB04.1BA8E714 (3869162244.108045999)
            t2: E69EBB06.56C67329 (3869162246.338965604)
            t3: E69EBB06.56C7EBD7 (3869162246.338988056)
            t4: E69EBB04.253868FD (3869162244.145391999)
        offset: 0000000000000002.3656877780000000 (2.212257830)
         delay: 0000000000000000.098E093B00000000 (0.037323548)
          mean: 00000000E69EBB06.56C72F8000000000 (3869162246.338976860)
         error: 0000000000000000.0A70800000000000 (0.040779114)
          addr: 194.0.5.123
}
sntp_exchange {
        result: 0 (Success)
        header: 24 (li:0 vn:4 mode:4)
       stratum: 02 (2)
          poll: 03 (8)
     precision: FFFFFFE9 (1.192093e-07)
         delay: 0000.0292 (0.010040283)
    dispersion: 0000.088C (0.033386230)
           ref: 82CFF4F0 (240.244.207.130)
         t_ref: E69EB714.886747A6 (3869161236.532825925)
            t1: E69EBB04.259A0F0A (3869162244.146881999)
            t2: E69EBB06.604D6F99 (3869162246.376181578)
            t3: E69EBB06.60504E4E (3869162246.376225370)
            t4: E69EBB04.2E9EE45C (3869162244.182111999)
        offset: 0000000000000002.3632654080000000 (2.211706475)
         delay: 0000000000000000.0901F69D00000000 (0.035186208)
          mean: 00000000E69EBB06.604EDEF380000000 (3869162246.376203537)
         error: 0000000000000000.09D5000000000000 (0.038406372)
          addr: 104.171.113.34
}
sntp_exchange {
        result: 0 (Success)
        header: 24 (li:0 vn:4 mode:4)
       stratum: 02 (2)
          poll: 03 (8)
     precision: FFFFFFE9 (1.192093e-07)
         delay: 0000.0292 (0.010040283)
    dispersion: 0000.088C (0.033386230)
           ref: 82CFF4F0 (240.244.207.130)
         t_ref: E69EB714.886747A6 (3869161236.532825925)
            t1: E69EBB04.2F1832FC (3869162244.183962999)
            t2: E69EBB06.69AC18D8 (3869162246.412782242)
            t3: E69EBB06.69B111C0 (3869162246.412858113)
            t4: E69EBB04.37FF8A8F (3869162244.218742999)
        offset: 0000000000000002.3622B68680000000 (2.211467178)
         delay: 0000000000000000.08E25EAB00000000 (0.034704129)
          mean: 00000000E69EBB06.69AE954C00000000 (3869162246.412820339)
         error: 0000000000000000.09D5000000000000 (0.038406372)
          addr: 104.171.113.34
}
sntp_exchange {
        result: 0 (Success)
        header: 24 (li:0 vn:4 mode:4)
       stratum: 03 (3)
          poll: 00 (1)
     precision: FFFFFFE7 (2.980232e-08)
         delay: 0000.2705 (0.152420044)
    dispersion: 0000.0097 (0.002304077)
           ref: 34EF7931 (49.121.239.52)
         t_ref: E69EB95F.77A52818 (3869161823.467363839)
            t1: E69EBB04.388E1501 (3869162244.220917999)
            t2: E69EBB06.797BA0F1 (3869162246.474542673)
            t3: E69EBB06.79807F7F (3869162246.474616974)
            t4: E69EBB04.4CB04AB6 (3869162244.299564999)
        offset: 0000000000000002.36DEE05C80000000 (2.214338324)
         delay: 0000000000000000.141D572700000000 (0.078572700)
          mean: 00000000E69EBB06.797E103800000000 (3869162246.474579811)
         error: 0000000000000000.1419800000000000 (0.078514099)
          addr: 185.216.231.84
}
selected:
sntp_exchange {
        result: 0 (Success)
        header: 24 (li:0 vn:4 mode:4)
       stratum: 02 (2)
          poll: 03 (8)
     precision: FFFFFFE9 (1.192093e-07)
         delay: 0000.0292 (0.010040283)
    dispersion: 0000.088C (0.033386230)
           ref: 82CFF4F0 (240.244.207.130)
         t_ref: E69EB714.886747A6 (3869161236.532825925)
            t1: E69EBB04.2F1832FC (3869162244.183962999)
            t2: E69EBB06.69AC18D8 (3869162246.412782242)
            t3: E69EBB06.69B111C0 (3869162246.412858113)
            t4: E69EBB04.37FF8A8F (3869162244.218742999)
        offset: 0000000000000002.3622B68680000000 (2.211467178)
         delay: 0000000000000000.08E25EAB00000000 (0.034704129)
          mean: 00000000E69EBB06.69AE954C00000000 (3869162246.412820339)
         error: 0000000000000000.09D5000000000000 (0.038406372)
          addr: 104.171.113.34
}
+2.211467 +/- 0.073111 pool.ntp.org 104.171.113.34

> sntp -S poot.net.org
sntp: Exchange failed: DNS lookup failure
sntp_exchange {
        result: 1 (DNS lookup failure)
}


> sudo sntp -s 185.216.231.84
sntp: Exchange failed: Timeout
sntp_exchange {
        result: 6 (Timeout)

see

clock_settime(2), adjtime(2), timed(8), sntpd(8)

Time.is compares system time to NTP server.