Oberon || Library || Module Index || Search Engine || Definition || Module


Ulm's Oberon Library:
Times


NAME

Times - reference scale for time measuring systems

SYNOPSIS

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);

DESCRIPTION

Times is a reference scale implementation for time measuring systems. Times is based upon Scales, Operations and PersistentObjects. Its main use is to allow independence from a particular time representation while arithmetic and other operations are still possible.

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.

SEE ALSO

Clocks
general interface for clocks
Operations
operations for time measures
PersistentObjects
interface for persistent objects
Scales
general management of measure systems and various error checks
TimeConditions
conditions which allow to wait for a given time

Edited by: borchert, last change: 1996/09/13, revision: 1.6, converted to HTML: 1997/04/28

Oberon || Library || Module Index || Search Engine || Definition || Module