timeval: Get an Amiga timeval struct value from raw data

View source: R/generic_support.r

timevalR Documentation

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)

Arguments

x

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

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.

Value

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

Author(s)

Pepijn de Vries

References

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

Examples

## 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)

AmigaFFH documentation built on June 22, 2024, 11:03 a.m.