I am trying encode and decode NTP timestamp (64-bit) format mentioned in RFC 5905 Section 6.
Please explain me how to encode and decode 64-bit NTP timestamp with an example.
The open source Apache Commons Net project includes a Java implementation that encodes and decodes the NTP packet including the NTP 64-bit timestamp.
The NTP 64-bit timestamp is composed of 32-bits for the seconds field and 32-bits for the fractional seconds. The most significant bit (MSB) of seconds value defines the base date as 7-Feb-2036 if 0 or 1-Jan-1900 if 1.
The TimeStamp class encapsulates the conversion of Java Time (i.e., milliseconds since 1-Jan-1970 Epoch) to/from the NTP 64-bit representation. See TimeStamp.toNtpTime() and TimeStamp.getTime() methods. The encoding/decoding is straightforward to convert to C/C# or another language.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With