Index

Package: Real_Time

Description

package Support.Real_Time is

Types

Timer_Type

type Timer_Type is limited private;
A simple generic timer used to calculate elapsed time.

Frame_Timer

type Frame_Timer is limited private;
A timer used specifically for calculating frame rates.

Subprograms & Entries

Elapsed

function Elapsed
( t: Timer_Type ) return Time_Span;
Return the elapsed time counted by the timer.

Is_Running

function Is_Running
( t: Timer_Type ) return Boolean;
Returns True if the timer has been started and isn't paused.

Pause

procedure Pause
( t: in out Timer_Type );
Pauses the timer. Elapsed time will not accumulate until the timer is started again.

Restart

procedure Restart
( t: in out Timer_Type );
Clears elapsed time and starts the timer again.

Start

procedure Start
( t: in out Timer_Type );
Starts or resumes the timer. This will have no effect if the timer is already running.

Is_Updated

function Is_Updated
( t: Frame_Timer ) return Boolean;
Returns true if the rate has been updated since the last check. Note that this doesn't mean the rate has changed in value, it means it has been recalculated.

Rate

function Rate
( t: access Frame_Timer ) return Natural;
Returns the current frame rate. The value returned is FPS.

Rate

procedure Rate
( t: in out Frame_Timer;
fps: out Natural );
Returns the current frame rate.

Set_Update_Delay

procedure Set_Update_Delay
( t: in out Frame_Timer;
ts: Time_Span );
Sets the minimum time to collect ticks before updating the current rate

Tick

procedure Tick
( t: in out Frame_Timer );
Notifies the timer of a complete frame.

Format

function Format
( ts: Time_Span ) return String;
Returns a string representation of 'ts' with the nearest applicable units. Example: "10[ms]", "10[s]", "10[min]"

To_Float

function To_Float
( ts: Time_Span ) return Long_Float;
Returns 'ts' as a Long_Float, based in seconds.

To_Microseconds

function To_Microseconds
( ts: Time_Span ) return Natural;
Returns 'ts' rounded to the nearest microsecond.

To_Milliseconds

function To_Milliseconds
( ts: Time_Span ) return Natural;
Returns 'ts' rounded to the nearest millisecond.

To_Minutes

function To_Minutes
( ts: Time_Span ) return Natural;
Returns 'ts' rounded to the nearest minute.

To_Seconds

function To_Seconds
( ts: Time_Span ) return Natural;
Returns 'ts' rounded to the nearest second.

To_String

function To_String
( t: Time ) return String;
Returns a string representation of Time 't' as a floating point number of seconds since the epoch (typically machine boot), with three digits to the right of the decimal.

To_String

function To_String
( ts: Time_Span;
precision: Natural := 3 ) return String;
Returns a string representation of 'ts' as a floating point number in seconds, with 'precision' number of digits to the right of the decimal.

Time_Input

function Time_Input
( stream: access Root_Stream_Type'Class ) return Time;
Reads a Time record from a stream.

Time_Output

procedure Time_Output
( stream: access Root_Stream_Type'Class;
t: Time );
Writes a Time record to a stream.