Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

Stopwatch::IsHighResolution Field

Indicates whether the timer is based on a high-resolution performance counter. This field is read-only.

Namespace:  System.Diagnostics
Assembly:  System (in System.dll)
static initonly bool IsHighResolution

The timer used by the Stopwatch class depends on the system hardware and operating system. IsHighResolution is true if the Stopwatch timer is based on a high-resolution performance counter. Otherwise, IsHighResolution is false, which indicates that the Stopwatch timer is based on the system timer.

The following example displays the frequency and resolution of a Stopwatch timer. This code example is part of a larger example provided for the Stopwatch class.

void DisplayTimerProperties()
   // Display the timer frequency and resolution. 
   if ( Stopwatch::IsHighResolution )
      Console::WriteLine( "Operations timed using the system's high-resolution performance counter." );
      Console::WriteLine( "Operations timed using the DateTime class." );

   Int64 frequency = Stopwatch::Frequency;
   Console::WriteLine( "  Timer frequency in ticks per second = {0}", frequency );
   Int64 nanosecPerTick = (1000L * 1000L * 1000L) / frequency;
   Console::WriteLine( "  Timer is accurate within {0} nanoseconds", nanosecPerTick );

Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98, Windows CE, Windows Mobile for Smartphone, Windows Mobile for Pocket PC, Xbox 360, Zune

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5, 3.0, 2.0

.NET Compact Framework

Supported in: 3.5

XNA Framework

Supported in: 3.0, 2.0, 1.0
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

© 2014 Microsoft. All rights reserved.