HostTime.mesa
Copyright Ó 1988, 1991 by Xerox Corporation. All rights reserved.
Carl Hauser, October 27, 1988 1:53:22 pm PDT
A common notion of time representations, allowing BasicTime to be machine independent.
For each different hosts we must supply a diffent Impl behind this interface. For example, for Unix there is HostTimeUnixImpl. The idea is that the mapping between 4*32 bit numeric quantities and the abstract notion of seconds is entirely accomplished in the host-specific impl behind this interface.
For good measure, the host-specific impl is also responsible for making sense of time zone parameters.
DIRECTORY
BasicTime USING [ExtendedGMT, ZoneAndDST];
HostTime: CEDAR DEFINITIONS
~ BEGIN
Time: TYPE = RECORD[a, b, c, d: WORD ¬ 0];
Intended to be general enough to accomodate the results of the system gettime call on many systems. Not all words are used on any given system. The meaning of the different words is defined by the impl, e.g. HostTimeUnixImpl.
ExtendedGMT: TYPE = BasicTime.ExtendedGMT;
ZoneAndDST: TYPE = BasicTime.ZoneAndDST;
ExtendedGMTFromHostTime: PROC [Time] RETURNS [egmt: ExtendedGMT];
HostTimeFromExtendedGMT: PROC [egmt: ExtendedGMT] RETURNS [Time];
GetTime: PROC [] RETURNS [Time];
Obtain current time from host.
TimeToMicroseconds: PROC [Time] RETURNS [CARD];
Convert time to microseconds since the host-specific epoch and return the low-order 32 bits.
MicrosecondsToTime: PROC [CARD] RETURNS [Time];
Maybe not too useful?
TimeToSeconds: PROC [Time] RETURNS [REAL];
Seconds since the host epoch. Beware: reals have only 24 bits of precision, so the fractional part of the result is not as accurate as calling TimeToMicroseconds. However, the result never overflows.
SecondsToTime: PROC [REAL] RETURNS [Time];
GetZoneAndDST: PROC [] RETURNS [ZoneAndDST];
END.
Carl Hauser, October 25, 1988 5:28:20 pm PDT
New file