NewGamePhysics.Utilities.HighResolutionTimer Class Reference

Class which provides access to the high-resolution system timer via Interop calls into the Win32 API. More...

List of all members.

Static Public Member Functions

static long Counter ()
 Queries the high-performance counter.
static long Frequency ()
 Queries the high resolution-timer frequency.
static double Seconds ()
 Number of seconds since the system was started.

Detailed Description

Class which provides access to the high-resolution system timer via Interop calls into the Win32 API.

Definition at line 17 of file HighResolutionTimer.cs.


Member Function Documentation

static long NewGamePhysics.Utilities.HighResolutionTimer.Counter (  )  [static]

Queries the high-performance counter.

Returns:
Current count number.

Definition at line 41 of file HighResolutionTimer.cs.

00042         {
00043             long counter;
00044 
00045             if (!QueryPerformanceCounter(out counter))
00046             {
00047                 throw new Win32Exception("Error calling QueryPerformanceCounter()");
00048             }
00049 
00050             return counter;
00051         }

static long NewGamePhysics.Utilities.HighResolutionTimer.Frequency (  )  [static]

Queries the high resolution-timer frequency.

Returns:
A frequency in Hz.

Definition at line 57 of file HighResolutionTimer.cs.

00058         {
00059             long frequency;
00060 
00061             if (!QueryPerformanceFrequency(out frequency))
00062             {
00063                 throw new Win32Exception("Error calling QueryPerformanceFrequency()");
00064             }
00065 
00066             return frequency;
00067         }

static double NewGamePhysics.Utilities.HighResolutionTimer.Seconds (  )  [static]

Number of seconds since the system was started.

Returns:
A relative time in seconds.

Definition at line 73 of file HighResolutionTimer.cs.

00074         {
00075             return (double)Counter() / (double)Frequency();
00076         }


The documentation for this class was generated from the following file:

Generated by  doxygen 1.6.2