Time Handling Facilities

Part 2 of the Amulet Manual by Laird and Jones

Any variables that are meant to store time values must be declared of type timetyp . Assignments, operations, and comparisons can be performed on timetyp variables by various macros provided by the Amulet programming system. These macros include:


settime(tvar1, tvar2)

ARGUMENTS

tvar1: Time variable
tvar2: Time variable

DESCRIPTION

tvar1 is assigned the value stored in tvar2.


settime_hours( tvar, hr)
settime_minutes(tvar, min)
settime_seconds(tvar, sec)
settime_millisecs(tvar, msec)
settime_microsecs(tvar, usec)

ARGUMENTS

tvar: Time variable
hr: Integer value for hours
min: Integer value for minutes
sec: Integer value for seconds
msec: Integer value for milliseconds
usec: Integer value for microseconds

DESCRIPTION

The proper time field (hours, minutes, seconds, milliseconds, or microseconds) of tvar is set to the value provided.


addtime_hours(tvar, hr)
addtime_minutes(tvar, min)
addtime_seconds(tvar, sec)
addtime_millisecs(tvar, msec)
addtime_microsecs(tvar, usec)

ARGUMENTS

tvar: Time variable
hr: Integer value for hours
min: Integer value for minutes
sec: Integer value for seconds
msec: Integer value for milliseconds
usec: Integer value for microseconds

DESCRIPTION

The proper time field of tvar is incremented by the value provided.


difftime(tvar, t1, t2)

ARGUMENTS

tvar: Time variable to be assigned time difference between t1 and t2 (t1 must hold a more recent time than t2)
t1: Time variable
t2: Time variable

DESCRIPTION

The difftime() macro finds the time difference between t1 and t2. t1 must hold a time later than t2.


get_current_time(tvar)

ARGUMENTS

tvar: Time variable

DESCRIPTION

The current time of day is assigned to tvar.


timecmp(t1, rel, t2)

ARGUMENTS

t1: Time variable
t2: Time variable
rel: Relational operator (such as > or <)

DESCRIPTION

The macro timecmp() compares the values of t1 and t2 with regard to the relation rel. It returns the result of (t1 rel t2) as either 1 or 0. For example, timecmp(time1, <, time2) would return 1 if time1 < time2, otherwise it would return 0.