Text preview for : TimeConvert.mesa_Mar78.pdf part of xerox TimeConvert.mesa Mar78 xerox mesa 3.0_1977 listing TimeConvert.mesa_Mar78.pdf



Back to : TimeConvert.mesa_Mar78.pd | Home

TimeConvert.mesa 30-MAR-78 14:47:33 Page 1


-- TimeConvert.Mesa Edited by Johnsson on March 21, 1978 8:38 AM
DIRECTORY
InlineDefs: FROM "inlinedefs",
StringDefs: FROM "stringdefs",
TimeDefs: FROM "timedefs";
DEFINITIONS FROM TimeDefs;
TimeConvert: PROGRAM IMPORTS StringDefs EXPORTS TimeDefs SHARES TimeDefs
BEGIN
--This should be a constant in TimeDefs, but ...
DefaultTime: PackedTime = PackedTime[O,O];
UP: TYPE = POINTER TO UnpackedTime;


DivideTime: PROCEDURE [num: PackedTime, den: CARDINAL]
RETURNS [quotient: PackedTime, remainder: CARDINAL] =
BEGIN OPEN InlineDefs;
t: CARDINAL;
[quotient.highbits, t] ~ LDIVMOD[num.highbits,O,den];
[quotient.lowbits, remainder] ~ LDIVMOD[num.lowbits,t,den];
RETURN
END;
MultiplyTime: PROCEDURE [multiplicand: PackedTime, multiplier: CARDINAL]
RETURNS [result: PackedTime] =
BEGIN OPEN InlineDefs;
t: CARDINAL;
result.highbits ~ multiplicand.highbits * multiplier;
[result.lowbits, t] ~ LongMult[multiplicand.lowbits, multiplier].product;
result.highbits ~ result.highbits + t;
RETURN
END;
AddTime: PROCEDURE [a: PackedTime, b: INTEGER] RETURNS [PackedTime]
BEGIN
t: CARDINAL = a.lowbits;
a.lowbits ~ a.lowbits + b;
IF b > 0 THEN
BEGIN IF a.lowbits < t THEN a.highbits ~ a.highbits+1 END
ELSE IF a.lowbits > t THEN a.highbits ~ a.highbits-1;
RETURN[a]
END;
CurrentDayTime: PUBLIC PROCEDURE RETURNS [PackedTime] =
BEGIN
t: HardwareTime ~ currentTime~;
IF currentParameters.beginDST = 0 THEN -- compatibility
RETURN[AddTime[[highbits: t.high, lowbits: t.low],8*60*60]]
ELSE RETURN[[highbits: t.high, lowbits: t.low]]
END;
TimeParameters: PROCEDURE
RETURNS [beginDST, endDST: CARDINAL, zone, zoneminutes: INTEGER] =
BEGIN
direction: WestEast;
[beginDST: beginDST, endDST: endDST, zone: zone, zoneminutes: zoneminutes, direction: direction] ~ cu
*