Environment.TickCount プロパティとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > Environment.TickCount プロパティの意味・解説 

Environment.TickCount プロパティ

システム起動後のミリ秒単位の経過時間を取得します。

名前空間: System
アセンブリ: mscorlib (mscorlib.dll 内)
構文構文

解説解説

このプロパティの値はシステム タイマから取得され、32 ビット符号付き整数として格納されます。そのため、システムを終了せずに実行し続けた場合、TickCount はゼロから Int32.MaxValue (約 24.9 日) までインクリメントされた後、いったん Int32.MinValue (負数) になり、再び、ゼロに戻ってから、次の 24.9 日までインクリメントされます。

TickCount プロパティの解像度は、500 ミリ秒未満には設定できません。

TickCount は、西暦 1 年 1 月 1 日午前 12:00 時からの経過時間を 100 ナノ秒単位で示す Ticks プロパティとは異なります。

このコンピュータの現在のローカルな日付と時刻を取得するには、DateTime.Now プロパティを使用します。

使用例使用例

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
*/
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照



英和和英テキスト翻訳

英語⇒日本語日本語⇒英語

辞書ショートカット

すべての辞書の索引

「Environment.TickCount プロパティ」の関連用語

Environment.TickCount プロパティのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



Environment.TickCount プロパティのページの著作権

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2026 Microsoft.All rights reserved.

©2026 GRAS Group, Inc.RSS