付録 B. NTP データ形式
UDP ヘッダの直後に続く NTP データ部の形式を、各フィールドの説明とともに以下に示す。
0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|LI | Status | Type | Precision |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Estimated Error |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Estimated Drift Rate |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Reference Clock Identifier |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| |
| Reference Timestamp (64 bits) |
| |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| |
| Originate Timestamp (64 bits) |
| |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| |
| Receive Timestamp (64 bits) |
| |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| |
| Transmit Timestamp (64 bits) |
| |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Leap Indicator (LI)
現在の月の最終日の終わりに挿入される予定のうるう秒を予告するコード。ビットは次のように符号化される。
00 no warning
01 +1 second (following minute has 61 seconds)
10 -1 second (following minute has 59 seconds)
11 reserved for future use
Status
ローカルクロックの状態を示すコード。値は次のように定義される。
0 clock operating correctly
1 carrier loss
2 synch loss
3 format error
4 interface (Type 1) or link (Type 2) failure
(additional codes reserved for future use)
Reference Clock Type (Type)
基準クロックの種類を識別するコード。値は次のように定義される。
0 unspecified
1 primary reference (e.g. radio clock)
2 secondary reference using an Internet host via NTP
3 secondary reference using some other host or protocol
4 eyeball-and-wristwatch
(additional codes reserved for future use)
Precision
+32 から -32 の範囲の符号付き整数で、ローカルクロックの精度を最も近い 2 のべき乗の秒数で示す。
Estimated Error
最後に設定された時点でのローカルクロックの推定誤差を示す固定小数点数。秒単位で、小数点はビット 15 と 16 の間にある。
Estimated Drift Rate
ローカルクロックの推定ドリフト率を示す符号付き固定小数点数。無次元の単位で、小数点は最上位ビットの左にある。
Reference Clock Identifier
特定の基準クロックを識別するコード。タイプ 1 (一次基準) の場合、これはクロックを識別する、左詰めでゼロ埋めされた ASCII 文字列であり、たとえば次のようなものである。
WWVB WWVB radio clock (60 KHz)
GOES GOES satellite clock (468 HMz)
WWV WWV radio clock (2.5/5/10/15/20 MHz)
(and others as necessary)
タイプ 2 (二次基準) の場合、これは基準ホストの 32 ビットのインターネットアドレスである。それ以外の場合、このフィールドは将来の使用のために予約されており、ゼロに設定すべきである。
Reference Timestamp
ローカルクロックが最後に設定または補正されたローカル時刻。
Originate Timestamp
要求がクライアントホストからサービスホストに向けて出発したローカル時刻。
Receive Timestamp
要求がサービスホストに到着したローカル時刻。
Transmit Timestamp
応答がサービスホストからクライアントホストに向けて出発したローカル時刻。