realtimeclock implementation for windows-systems More...
#include <mitkWindowsRealTimeClock.h>


Public Types | |
| typedef WindowsRealTimeClock | Self |
| typedef mitk::RealTimeClock | Superclass |
| typedef itk::SmartPointer< Self > | Pointer |
| typedef itk::SmartPointer < const Self > | ConstPointer |
Public Member Functions | |
| virtual const char * | GetClassName () const |
| WindowsRealTimeClock () | |
| basic contructor | |
| virtual | ~WindowsRealTimeClock () |
| basic destructor | |
| virtual double | GetCurrentStamp () |
| returns the current time in milliseconds as a double | |
| virtual LARGE_INTEGER | GetFrequency () |
| returns the QueryPerformanceFrequency | |
Static Public Member Functions | |
| static Pointer | New () |
| instanciates a new, operating-system dependant, instance of mitk::RealTimeClock. | |
Protected Member Functions | |
| void | SetFrequency () |
Protected Attributes | |
| LARGE_INTEGER | m_Frequency |
| Frequency needed to calculate time from tick-counter. | |
realtimeclock implementation for windows-systems
This class provides a RealTimeClock for windows-systems. Internally, it uses the QueryPerformanceCounter and the QueryPerformaceFrequency. It polls the current tick-counter, that counts from bootup. is supposed to be the most accurate time you can get on a windows-system.
Definition at line 38 of file mitkWindowsRealTimeClock.h.
| typedef itk::SmartPointer<const Self> mitk::WindowsRealTimeClock::ConstPointer |
Reimplemented from mitk::RealTimeClock.
Definition at line 41 of file mitkWindowsRealTimeClock.h.
| typedef itk::SmartPointer<Self> mitk::WindowsRealTimeClock::Pointer |
Reimplemented from mitk::RealTimeClock.
Definition at line 41 of file mitkWindowsRealTimeClock.h.
Reimplemented from mitk::RealTimeClock.
Definition at line 41 of file mitkWindowsRealTimeClock.h.
Reimplemented from mitk::RealTimeClock.
Definition at line 41 of file mitkWindowsRealTimeClock.h.
| mitk::WindowsRealTimeClock::WindowsRealTimeClock | ( | ) |
basic contructor
Definition at line 26 of file mitkWindowsRealTimeClock.cpp.
References SetFrequency().
{
SetFrequency();
}
| mitk::WindowsRealTimeClock::~WindowsRealTimeClock | ( | ) | [virtual] |
| virtual const char* mitk::WindowsRealTimeClock::GetClassName | ( | ) | const [virtual] |
Reimplemented from mitk::RealTimeClock.
| double mitk::WindowsRealTimeClock::GetCurrentStamp | ( | ) | [virtual] |
returns the current time in milliseconds as a double
Uses the QueryPerformanceCounter to acquire an accurate time. (Ticks counted / Frequency) = time in ms
Implements mitk::RealTimeClock.
Definition at line 50 of file mitkWindowsRealTimeClock.cpp.
{
// "if defined" not really necessary in this case, as the class is only available on Windows-systems
__int64 time, ticks = 0;
if (m_Frequency.QuadPart < 1)
{
return -1.0;
}
QueryPerformanceCounter( (LARGE_INTEGER*) &ticks);
time = (ticks * 100000) / this->m_Frequency.QuadPart;
double milliseconds = (double) (time & 0xffffffff);
milliseconds /= (double)100.0;
return milliseconds;
}
| LARGE_INTEGER mitk::WindowsRealTimeClock::GetFrequency | ( | ) | [virtual] |
returns the QueryPerformanceFrequency
returns the QueryPerformanceFrequency, needed for acquiring the time from ticks
Definition at line 70 of file mitkWindowsRealTimeClock.cpp.
{
return this->m_Frequency;
}
| static Pointer mitk::WindowsRealTimeClock::New | ( | void | ) | [static] |
instanciates a new, operating-system dependant, instance of mitk::RealTimeClock.
Reimplemented from mitk::RealTimeClock.
| void mitk::WindowsRealTimeClock::SetFrequency | ( | ) | [protected] |
Definition at line 39 of file mitkWindowsRealTimeClock.cpp.
Referenced by WindowsRealTimeClock().
{
if ( !QueryPerformanceFrequency(&m_Frequency) )
{
m_Frequency.QuadPart = 0;
}
}
LARGE_INTEGER mitk::WindowsRealTimeClock::m_Frequency [protected] |
Frequency needed to calculate time from tick-counter.
Definition at line 74 of file mitkWindowsRealTimeClock.h.
1.7.2