Skip to contents

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.

Value

Returns a numeric

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

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.

Author

Pepijn de Vries

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)
#> 1.000001 [s] Amiga timeval struct

## You can use 'as.raw' to get the original raw data again:
as.raw(temp)
#> [1] 00 00 00 01 00 00 00 01