[IGSTK-Developers] Clock and TimeStamp problem

Patrick Cheng cheng at isis.georgetown.edu
Thu Mar 2 15:02:40 EST 2006


This is the major changes:

IGSTKSandbox: IGSTK/Source/igstkRealTimeClock.cxx
Change the returned time unit to milliseconds
http://public.kitware.com/cgi-bin/viewcvs.cgi/IGSTK/Source/igstkRealTimeClock.cxx?root=IGSTKSandbox&r1=1.1&r2=1.2

IGSTKSandbox: IGSTK/Source/igstkPulseGenerator.cxx
The time period unit for time out is changed into milliseconds
http://public.kitware.com/cgi-bin/viewcvs.cgi/IGSTK/Source/igstkPulseGenerator.cxx?root=IGSTKSandbox&r1=1.1&r2=1.2

IGSTKSandbox: IGSTK/Testing/igstkViewRefreshRateTest.cxx
http://public.kitware.com/cgi-bin/viewcvs.cgi/IGSTK/Testing/igstkViewRefreshRateTest.cxx?root=IGSTKSandbox&r1=1.1&r2=1.2
The problem with this test is: The testing frequency is too high 
(30&60Hz) for it to pass (I lower it to 20&40Hz)

One place we need to pay attention is: When we use time stamp directly 
with the frequency.
IGSTKSandbox: IGSTK/Source/igstkView.cxx
Line 420
-------------------------------------------------------------------
TimeStamp renderTime;
double frequency = m_PulseGenerator->GetFrequency();
// Frequency is in milliseconds
renderTime.SetStartTimeNowAndExpireAfter( 1000.0 / frequency );
                                           ^^^^^^
-------------------------------------------------------------------



The reason for changing the unit is to avoid confusion and being 
consistent.
Please refer to this function in TimeStamp:
--------------------------------------------------------------------
TimeStamp
::SetStartTimeNowAndExpireAfter(double millisecondsToExpire)
{
   this->m_StartTime      = RealTimeClock::GetTimeStamp();
   this->m_ExpirationTime = this->m_StartTime + millisecondsToExpire;
}
---------------------------------------------------------------------


One more place we need to pay attention to is:
Every time we set the new transform, for instance:

transform.SetToIdentity( ValidTimePeriod ), the 'ValidTimePeriod' is a 
duration starting from this moment.

But programmer might mistakenly program it like:
transform1.SetToIdentity( transform2.GetExpirationTime() ), Which uses 
a absolute time, this will be a big mistake.

We should try to avoid that.


-- 
Patrick Cheng
cheng at isis.georgetown.edu

IGSTK - Open Source Software Toolkit for Image Guided Surgery
http://www.igstk.org
http://public.kitware.com/IGSTKWIKI





More information about the IGSTK-Developers mailing list