Environment.TickCount プロパティ
アセンブリ: mscorlib (mscorlib.dll 内)


このプロパティの値はシステム タイマから取得され、32 ビット符号付き整数として格納されます。そのため、システムを終了せずに実行し続けた場合、TickCount はゼロから Int32.MaxValue (約 24.9 日) までインクリメントされた後、いったん Int32.MinValue (負数) になり、再び、ゼロに戻ってから、次の 24.9 日までインクリメントされます。
TickCount プロパティの解像度は、500 ミリ秒未満には設定できません。
TickCount は、西暦 1 年 1 月 1 日午前 12:00 時からの経過時間を 100 ナノ秒単位で示す Ticks プロパティとは異なります。

TickCount プロパティから返される正数範囲の値を取得する方法を次のコード例に示します。TickCount プロパティは、負数である Int32.MinValue から Int32.MaxValue までを 1 サイクル (49.8 日) として動作します。このコード サンプルでは、ゼロから MaxValue を 1 サイクル (24.9 日) とする負数以外の数値を取得するために、符号ビットを取り除く処理を行っています。
' Sample for the Environment.TickCount property. ' TickCount cycles between Int32.MinValue, which is a negative ' number, and Int32.MaxValue once every 49.8 days. This sample ' removes the sign bit to yield a nonnegative number that cycles ' between zero and Int32.MaxValue once every 24.9 days. Imports System Class Sample Public Shared Sub Main() Dim result As Integer = Environment.TickCount And Int32.MaxValue Console.WriteLine("TickCount: {0}", result) End Sub 'Main End Class 'Sample ' 'This example produces the following results: ' 'TickCount: 101931139 '
// Sample for the Environment.TickCount property. // TickCount cycles between Int32.MinValue, which is a negative // number, and Int32.MaxValue once every 49.8 days. This sample // removes the sign bit to yield a nonnegative number that cycles // between zero and Int32.MaxValue once every 24.9 days. using System; class Sample { public static void Main() { int result = Environment.TickCount & Int32.MaxValue; Console.WriteLine("TickCount: {0}", result); } } /* This example produces the following results: TickCount: 101931139 */
// Sample for the Environment::TickCount property // TickCount cycles between Int32::MinValue, which is a negative // number, and Int32::MaxValue once every 49.8 days. This sample // removes the sign bit to yield a nonnegative number that cycles // between zero and Int32::MaxValue once every 24.9 days. using namespace System; int main() { int result = Environment::TickCount & Int32::MaxValue; Console::WriteLine( "TickCount: {0}", result ); } /* This example produces the following results: TickCount: 101931139 */
// Sample for the Environment.TickCount property import System.*; class Sample { public static void main(String[] args) { Console.WriteLine(); Console.WriteLine("TickCount: {0}", System.Convert.ToString(Environment.get_TickCount())); } //main } //Sample /* This example produces the following results: TickCount: 17995355 */

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


- Environment.TickCount プロパティのページへのリンク