Difference between revisions of "OpenIGTLink/Timestamp"
(New page: << OpenIGTLink NTP4 Timestamp is defined by [http://www.faqs.org/rfcs/rfc2030.html RFC 2030] and [http://www.faqs.org/rfcs/rfc1305.html RFC 1305]. (See "3. NTP Ti...) |
|||
Line 31: | Line 31: | ||
'''Wrap around:''' in year 2104 | '''Wrap around:''' in year 2104 | ||
+ | |||
+ | == Obtaining timestamp == | ||
+ | |||
+ | Intel IA32 instruction [http://www.intel.com/design/pentium4/manuals/245471.htm RDTSC] | ||
+ | * '''Windows:''' Use [http://msdn2.microsoft.com/en-us/library/ms644904.aspx QueryPerformanceCounter()] or [http://msdn2.microsoft.com/en-us/library/ms713418(VS.85).aspx timeGetTime()] (10ms) | ||
+ | |||
+ | == Calibrating the counters == | ||
+ | # Install NTP or compute timestamp differences | ||
+ | # Calibrate timestamp (counter) - real time difference |
Revision as of 07:20, 10 January 2008
Home < OpenIGTLink < Timestamp
NTP4 Timestamp is defined by RFC 2030 and RFC 1305. (See "3. NTP Timestamp Format")
Big Endian format: NTP data are specified as integer or fixed-point quantities, with bits numbered in big-endian fashion from 0 starting at the left, or high-order, position.
Seconds and fraction of seconds: NTP timestamps are represented as a 64-bit unsigned fixed-point number, in seconds relative to 0h on 1 January 1900. The integer part is in the first 32 bits and the fraction part in the last 32 bits. In the fraction part, the non-significant low order can be set to 0.
Convention: Note that, since some time in 1968 (second 2,147,483,648) the most significant bit (bit 0 of the integer part) has been set and that the 64-bit field will overflow some time in 2036 (second 4,294,967,296). There will exist a 232-picosecond interval, henceforth ignored, every 136 years when the 64-bit field will be 0, which by convention is interpreted as an invalid or unavailable timestamp.
If bit 0 is set, the UTC time is in the range 1968-2036 and UTC time is reckoned from 0h 0m 0s UTC on 1 January 1900. If bit 0 is not set, the time is in the range 2036-2104 and UTC time is calculated from 6h 28m 16s UTC on 7 February 2036. Note that when calculating the correspondence, 2000 is a leap year and leap seconds are not included in the reckoning.
Precision: 200 picoseconds
Wrap around: in year 2104
Obtaining timestamp
Intel IA32 instruction RDTSC
- Windows: Use QueryPerformanceCounter() or timeGetTime() (10ms)
Calibrating the counters
- Install NTP or compute timestamp differences
- Calibrate timestamp (counter) - real time difference