Data Fields | |
ucnt32_t | fraction |
The fractions of the second. | |
ucnt32_t | seconds |
The seconds. |
NTP time stamp type.
The NTP time stamp type as whole is a 64 bit unsigned number the upper 32 bits being the seconds since era start and the lower 32 bits being their fraction in 2**-32 = ~0.23ns resolution.
Even being unsigned by declaration differences may be negative appearing as very large numbers. Modulo arithmetic will tread them right in addition and subtraction — only careless comparisons might go wrong.
/note Both parts (and the whole thing) is in wrong (big endian / network) byte order.
The seconds.
The zero date for NTP (era 0) is January 1st 1900 (1900-1-1; 1.1.1900) UTC. The wrap around at February 7th 2036 (next "era") is happily defined using 2**32 modulo arithmetic in a way one practically hasn't to worry about.
/note This field is in wrong (big endian / network) byte order.
The fractions of the second.
The Bits of fraction.v8[3] are to be interpreted as [7|...|0]:
1/2 s | 1/4 s | 1/8 s | 1/16 s | ...
500 ms | 250 ms | 125 ms | ~62 ms ... The fraction digits 1/16 s and below cannot be expressed in ms. This is a complication for (most) systems using ms (or µs) clocks respectively counters.