Note
Access to this page requires authorization. You can try signing in or .
Access to this page requires authorization. You can try .
Environment.TickCount Property
Definition
- Namespace:
- System
- Assemblies:
- mscorlib.dll, System.Runtime.Extensions.dll
- Assemblies:
- netstandard.dll, System.Runtime.dll
- Assembly:
- System.Runtime.Extensions.dll
- Assembly:
- mscorlib.dll
- Assembly:
- netstandard.dll
- Source:
- Environment.cs
- Source:
- Environment.cs
- Source:
- Environment.cs
- Source:
- Environment.cs
- Source:
- Environment.cs
Important
Some information relates to prerelease product that may be substantially modified before itβs released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets the number of milliseconds elapsed since the system started.
public:
static property int TickCount { int get(); };
public static int TickCount { get; }
static member TickCount : int
Public Shared ReadOnly Property TickCount As Integer
Property Value
A 32-bit signed integer containing the amount of time in milliseconds that has passed since the last time the computer was started.
Remarks
This property returns the truncated result of TickCount64. For version differences and information about update frequency, see the TickCount64 remarks.
Important
Because the value of the TickCount property value is a 32-bit signed integer, if the system runs continuously, TickCount increments from zero to Int32.MaxValue for approximately 24.9 days, then jumps to Int32.MinValue, which is a negative number, then increments back to zero during the next 24.9 days. You can work around this issue by casting the result of TickCount to uint. This works because int and uint are a two's complement representation. This workaround is valid on all platforms.
TickCount is different from the DateTime.Ticks property, which is the number of 100-nanosecond intervals that have elapsed since 1/1/0001, 12:00am.
Use the DateTime.Now property to obtain the current local date and time.
Applies to
See also
Feedback
Was this page helpful?
