Difference between revisions of "OpenIGTLink/Timestamp"
From NAMIC Wiki
(3 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
− | [[OpenIGTLink | << OpenIGTLink]] | + | [[OpenIGTLink | << OpenIGTLink]] | [[OpenIGTLink/Protocol | Protocol]] |
Line 13: | Line 13: | ||
== Obtaining timestamp == | == Obtaining timestamp == | ||
+ | * [http://www.itk.org/Doxygen34/html/classitk_1_1RealTimeClock.html itk::RealTimeClock] | ||
* '''Linux''' / '''Mac''': [http://www.hmug.org/man/3/ftime.php ftime()] | * '''Linux''' / '''Mac''': [http://www.hmug.org/man/3/ftime.php ftime()] | ||
* '''Windows''': [http://msdn2.microsoft.com/en-us/library/z54t9z5f(VS.71).aspx ftime()] - 10 ms resolution | * '''Windows''': [http://msdn2.microsoft.com/en-us/library/z54t9z5f(VS.71).aspx ftime()] - 10 ms resolution |
Latest revision as of 21:58, 11 February 2008
Home < OpenIGTLink < Timestamp
Big Endian format: bits numbered in big-endian fashion from 0 starting at the left, or high-order, position.
Seconds and fraction of seconds: timestamps are represented as a 64-bit unsigned fixed-point number, in seconds relative to 00:00:00 January 1, 1970, UTC. The integer part is in the first 32 bits (Unix-style timestamp) and the fraction part in the last 32 bits. In the fraction part, the non-significant low order can be set to 0.
Wrap around: The first 32-bit field will overflow some time in 2106 (second 4,294,967,296)
Obtaining timestamp
- itk::RealTimeClock
- Linux / Mac: ftime()
- Windows: ftime() - 10 ms resolution
- Old Timestamp - 1 sec resoultion: Now, Time, Timer
- System time - 10 msec resolution: GetTickCount, GetTickCount64 or timeGetTime()
- Highres - hardware dependent: QueryPerformanceCounter (Intel IA32 instruction: RDTSC)
Time synchronization
Two solutions:
- Install NTP on all devices
- Compute timestamp differences (local NTP can be used)
Resources
- NTP4 Timestamp: RFC 2030 and RFC 1305. (See "3. NTP Timestamp Format")
- Obtaining Accurate Timestamps under Windows XP