The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

Stopwatch.GetTimestamp Method

Gets the current number of ticks in the timer mechanism.

Namespace: System.Diagnostics
Assembly: System (in system.dll)

Public Shared Function GetTimestamp As Long
Dim returnValue As Long

returnValue = Stopwatch.GetTimestamp
public static long GetTimestamp ()
public static function GetTimestamp () : long
Not applicable.

Return Value

A long integer representing the tick counter value of the underlying timer mechanism.

If the Stopwatch class uses a high-resolution performance counter, GetTimestamp returns the current value of that counter. If the Stopwatch class uses the system timer, GetTimestamp returns the current DateTime.Ticks property of the DateTime.Now instance.

The following example illustrates setting a performance counter with the GetTimestamp method.

' Create the counter.
Dim PC As PerformanceCounter
PC = New PerformanceCounter(categoryName, counterName, False)

' Initialize the counter.
PC.RawValue = Stopwatch.GetTimestamp()

// Create the performance counter.
PerformanceCounter pc = new PerformanceCounter(categoryName,
    counterName, false);
// Initialize the counter.

Windows 98, Windows Server 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0

XNA Framework

Supported in: 1.0

Community Additions