Unit PXL.Timing

DescriptionUsesClasses, Interfaces, Objects and RecordsFunctions and ProceduresTypesConstantsVariables

Description

High accuracy timing and sleep routines that can be used across different platforms.

Overview

Classes, Interfaces, Objects and Records

Name Description
Class TMultimediaTimer A special-purpose timer implementation that can provide fixed frame-based processing independently of rendering frame rate.

Functions and Procedures

function GetSystemTickCount: Cardinal;
function GetSystemTimerValue: TSystemTimerValue;
function GetSystemTimeValue: Double;
procedure MicroSleep(const Microseconds: UInt64);
function TickCountInBetween(const Value1, Value2: Cardinal): Cardinal;
function TimerValueInBetween(const Value1, Value2: TSystemTimerValue): TSystemTimerValue;

Types

TSystemTimerValue = UInt64;

Description

Functions and Procedures

function GetSystemTickCount: Cardinal;

Returns current timer counter represented as 32-bit unsigned integer. The resulting value is specified in milliseconds. The value should only be used for calculating differences because it can wrap (from very high positive value back to zero) after prolonged time intervals. The wrapping usually occurs upon reaching High(Cardinal) but depending on each individual platform, it can also occur earlier.

function GetSystemTimerValue: TSystemTimerValue;

Returns current timer counter represented as 64-bit unsigned integer. The resulting value is specified in microseconds. The value should only be used for calculating differences because it can wrap (from very high positive value back to zero) after prolonged time intervals. The wrapping usually occurs upon reaching High(UInt64) but depending on each individual platform, it can also occur earlier.

function GetSystemTimeValue: Double;

Returns the current timer counter represented as 64-bit floating-point number. The resulting value is specified in milliseconds and fractions of thereof. The value should only be used for calculating differences because it can wrap (from very high positive value back to zero or even some negative value) after prolonged time intervals.

procedure MicroSleep(const Microseconds: UInt64);

Causes the calling thread to sleep for a given number of microseconds. The sleep can actually be interrupted under certain conditions (such as when a message is sent to the caller's thread).

function TickCountInBetween(const Value1, Value2: Cardinal): Cardinal;

Returns number of milliseconds between two values returned by GetSystemTickCount. This method takes into account potential value wrapping.

function TimerValueInBetween(const Value1, Value2: TSystemTimerValue): TSystemTimerValue;

Returns number of microseconds between two values returned by GetSystemTimerValue. This method takes into account potential value wrapping.

Types

TSystemTimerValue = UInt64;

Value type for GetSystemTimerValue, defined in microseconds.


Copyright © 2000 - 2017 Yuriy Kotsarenko. Help files generated by PasDoc.