timer.library Reference

Comprehensive function reference for timer.library, synthesised from the AmigaOS NDK 3.2 Release 4 (Autodocs/AG/timer).

This page documents 9 functions of timer.library. Each function entry follows the canonical autodoc format. struct Name, union Name, enum Name are clickable links to the type definition in the types reference.

Function index


AbortIO()

AbortIO -- Remove an existing timer request.

Synopsis

error = AbortIO( timerequest ) D0 A1

LONG AbortIO( struct timerequest * );

Function

This is an exec.library call.

This routine removes a timerquest from the timer.  It runs in
the context of the caller.

Inputs

timerequest - the timer request to be aborted

Notes

This function may be called from interrupts.

See also


AddTime()

AddTime -- Add one time request to another.

Synopsis

AddTime( Dest, Source ) A0 A1

void AddTime( struct timeval *, struct timeval *);

Function

This routine adds one timeval structure to another. The results are stored in the destination (Dest + Source -> Dest)

A0 and A1 will be left unchanged

Inputs

Dest, Source -- pointers to timeval structures.

Notes

This function may be called from interrupts.

See also

CmpTime(), SubTime()


CmpTime()

CmpTime -- Compare two timeval structures.

Synopsis

result = CmpTime( Dest, Source ) D0 A0 A1

LONG CmpTime( struct timeval *, struct timeval *);

Function

This routine compares timeval structures

A0 and A1 will be left unchanged

Inputs

Dest, Source -- pointers to timeval structures.

Results

result will be 0 if Dest has same time as source -1 if Dest has more time than source +1 if Dest has less time than source

Notes

This function may be called from interrupts.

Bugs

Older version of this document had the sense of the return codes wrong; the code hasn't changed but the document has.

See also

AddTime(), SubTime()


GetSysTime()

GetSysTime -- Get the system time. (V36)

Synopsis

GetSysTime( Dest ) A0

void GetSysTime( struct timeval * );

Function

Ask the system what time it is. The system time starts off at zero at power on, but may be initialized via the TR_SETSYSTIME timer.device command.

System time is monotonocally increasing and guarenteed to be
unique (except when the system time is set back).

A0 will be left unchanged.

This function is less expensive to use than the TR_GETSYSTIME
IORequest.

Inputs

Dest -- pointer to a timeval structure to hold the system time.

Results

Dest -- the timeval structure will contain the system time.

Notes

This function may be called from interrupts.


ReadEClock()

ReadEClock -- Get the current value of the E-Clock. (V36)

Synopsis

E_Freq = ReadEClock( Dest ) D0 A0

ULONG ReadEClock (struct EClockVal* );

Function

This routine calculates the current 64 bit value of the E-Clock and stores it in the destination EClockVal structure. The count rate of the E-Clock is also returned.

A0 will be left unchanged

This is a low overhead function designed so that very short
intervals may be timed.

Inputs

Dest -- pointer to an EClockVal structure.

Notes

This function may be called from interrupts.


SubTime()

SubTime -- Subtract one time request from another.

Synopsis

SubTime( Dest, Source ) A0 A1

void SubTime( struct timeval *, struct timeval *);

Function

This routine subtracts one timeval structure from another. The results are stored in the destination (Dest - Source -> Dest)

A0 and A1 will be left unchanged

Inputs

Dest, Source -- pointers to timeval structures.

Notes

This function may be called from interrupts.

See also

AddTime(), CmpTime()


TR_ADDREQUEST()

TR_ADDREQUEST -- Submit a request to wait a period of time.

Function

Ask the timer to wait a specified amount of time before replying the timerequest.

The message may be forced to finish early with an
AbortIO()/WaitIO() pair.

TIMER REQUEST io_Message mn_ReplyPort initialized io_Device preset by timer in OpenDevice io_Unit preset by timer in OpenDevice io_Command TR_ADDREQUEST io_Flags IOF_QUICK permitted (but ignored) tr_time a timeval structure specifying how long the device will wait before replying

Results

tr_time will be zeroed

Notes

This function may be called from interrupts.

Previous to 2.0, the tr_time field was documented as containing
junk when the timerequest was returned.

See also

AbortIO(), TimeDelay()


TR_GETSYSTIME()

TR_GETSYSTIME -- get the system time.

Function

Ask the system what time it is. The system time starts off at zero at power on, but may be initialized via the TR_SETSYSTIME call.

System time is monotonically increasing, and guaranteed to be
unique (except when the system time is set backwards).

TIMER REQUEST io_Message mn_ReplyPort initialized io_Device preset by timer in OpenDevice io_Unit preset by timer in OpenDevice io_Command TR_GETSYSTIME io_Flags IOF_QUICK permitted

Results

tr_time a timeval structure with the current system time

Notes

This function may be called from interrupts.

See also

GetSysTime()


TR_SETSYSTIME()

TR_SETSYSTIME -- Set the system time.

Function

Set the system idea of what time it is. The system starts out at time "zero" so it is safe to set it forward to the real time. However, care should be taken when setting the time backwards. System time is generally expected to monotonically increasing.

TIMER REQUEST io_Message mn_ReplyPort initialized io_Device preset by timer in OpenDevice io_Unit preset by timer in OpenDevice io_Command TR_GETSYSTIME io_Flags IOF_QUICK permitted tr_time a timeval structure with the current system time

Results

tr_time will contain junk

Notes

This function may be called from interrupts.

See also

GetSysTime()