Oberon || Library || Module Index || Search Engine || Definition || Module
CONST relative = Scales.relative; CONST absolute = Scales.absolute; TYPE Time = POINTER TO TimeRec; TYPE TimeRec = RECORD (Scales.MeasureRec) END; TYPE TimeValueRec = RECORD (Objects.ObjectRec) epoch: Scales.Value; second: Scales.Value; usec: Scales.Value; END; VAR scale: Scales.Scale; (* reference scale *) VAR family: Scales.Family; (* family of time scales *)
PROCEDURE Create(VAR time: Time; type: SHORTINT); PROCEDURE CreateAndSet(VAR time: Time; type: SHORTINT; epoch, second, usec: Scales.Value); PROCEDURE SetValue(time: Time; value: TimeValueRec); PROCEDURE GetValue(time: Time; VAR value: TimeValueRec);
Time serves as common base type of all time representations. While the measure type of Times is a non-exported extension of Time the representation itself is exported as TimeValueRec. Absolute time measures are represented like relative measures but are to be interpreted to be relative to Jan. 1, 1970, 0:00 GMT.
Measures of the reference time are given in non-negative seconds and microseconds. Since this covers only about 68 years, an epoch has been added to allow larger time ranges. Epoches have a length of MAX(Scales.Value) + 1 seconds. Negative epoches represent times before 1970 (in case of absolute measures) or earlier times (in case of relative measures).
The variables scale and family constitute the reference scale and the associated family. The units of scale are "epoch", "second" and "usec". They correspond to the components of TimeValueRec.
Create creates and initializes a measure of the reference scale. CreateAndSet creates and initializes time to the time value specified by epoch, second and usec.
SetValue and GetValue allow to access time measures which belong to family but not necessarily to scale. SetValue normalizes value in case of negative values of second or usec.
Oberon || Library || Module Index || Search Engine || Definition || Module