DateTime.Ticks

Syntax

Ticks: Integer;

Description

The Ticks property returns the number of milliseconds since the operating system startup.

Comments

The returned value is limited by the maximum available value for the Integer data type, that is, 2147483647. This value approximately equals to 24 days, 20 hours, 31 minutes and 23 seconds. On exceeding the specified period, value of the Ticks property is reset, and calculation starts from zero.

If it is supposed to work in the operating system longer than the specified period, it is recommended to use the Ticks64 property.

Example

Sub TestTicks;
Var
    i, j, Start, Stop, Temp: Integer;
Begin
    Start := DateTime.Ticks;
    For i := 1 To 300 Do
        For j := 1 To 300 Do
            Temp := Temp + i + j;
        End For;
    End For;
    Stop := DateTime.Ticks;
    Temp := Stop - Start;
    Debug.WriteLine("Time spent to execute cycles: " + (Temp / 1000).ToString + " sec.");
End Sub TestTicks;

After executing the example the console displays the value of the time spent to execute cycles.

See also:

DateTime