Skip to contents

This function converts date-time objects into raw data conform Amiga file system specifications.

Usage

amigaDateToRaw(x, format = c("long", "short"), tz = "UTC")

Arguments

x

A (vector of) POSIXt object(s).

format

a character string indicating whether the date should be stored as short or long integers.

tz

A character string specifying the time zone to be used to convert the date time object. Note that the time zone is not stored on the Amiga. By default the Universal time zone (UTC) is assumed. You will get a warning when you use a timezone other then UTC.

Value

returns raw data reflecting the date-time objects conform the Amiga file system specifications.

Details

The Amiga file system stores date time objects as three unsigned short (16 bit) or long (32 bit) integers. Where the values are number of days, minutes and ticks (fiftieth of a second) since 1978-01-01 respectively.

As these values are always positive, only date time values on or after 1978-01-01 are allowed. The inverse of this function can be achieved with rawToAmigaDate.

See also

Author

Pepijn de Vries

Examples

## Note that using the same date-time with different timezones will
## result in different raw data. The time zone is not stored.
amigaDateToRaw(as.POSIXct("1978-01-01 13:30", tz = "UTC"))
#>  [1] 00 00 00 00 00 00 03 2a 00 00 00 00
amigaDateToRaw(as.POSIXct("1978-01-01 13:30", tz = "CET"))
#> Warning: 'tzone' attributes are inconsistent
#>  [1] 00 00 00 00 00 00 02 ee 00 00 00 00