Learn R Programming

AmigaFFH (version 0.4.3)

timeval: Get an Amiga timeval struct value from raw data

Description

Some Amiga applications use a timeval struct (see references) to represent a time span in seconds. This function coerces raw data to such a numeric time span.

Usage

timeval(x)

Value

Returns a numeric

vector of a timespan in seconds. It is represented as an S3 AmigaTimeVal class.

Arguments

x

a vector of raw data that need to be converted into Amiga timeval structs.

Author

Pepijn de Vries

Details

Timeval is a structure (struct) as specified in device/timer.h on the Amiga (see references). It represents a timespan in seconds. This function retrieves the numeric value from raw data. Amongst others, the timeval struct was used in the system-configuration file (see SysConfig) to specify key repeat speed, key repeat delay and mouse double click speed. Use as.raw for the inverse of this function and get the original raw data.

References

http://amigadev.elowar.com/read/ADCD_2.1/Includes_and_Autodocs_2._guide/node0053.html

Examples

Run this code
## First four raw values represent seconds, the latter four microseconds:
temp <- timeval(as.raw(c(0, 0, 0, 1, 0, 0, 0, 1)))
print(temp)

## You can use 'as.raw' to get the original raw data again:
as.raw(temp)

Run the code above in your browser using DataLab