BasicTimeExtra.mesa
Copyright © 1985, 1986 by Xerox Corporation. All rights reserved.
Sturgis, March 27, 1986 11:15:27 am PST
Russ Atkinson (RRA) March 31, 1986 8:13:37 pm PST
DIRECTORY
BasicTime USING[GMT, Unpacked, Zone];
BasicTimeExtra: CEDAR DEFINITIONS = BEGIN OPEN BasicTime;
The following procedure should be added to:
BasicTime.Part III: Unpacked times
DST: TYPE = {yes, no, unspecified};
ControlledUnpack: PROC [time: GMT, zone: Zone, dst: DST ← unspecified, beginDST: [0..366] ← 0, endDST: [0..366] ← 0] RETURNS [Unpacked];
ControlledUnpack produces an unpacked time in the specified zone, and decides upon daylight savings time as follows: if dst = yes, then yes, if dst = no, then no, otherwise it checks the unpacked date against [beginDST..endDST], exactly as in Unpack.
ControlledUnpack is to be used in place of Unpack, whenever the client wants to directly control the zone and DST calculation. To get the effect of Unpack, execute the following code:
tp: BasicTime.ZoneAndDST = BasicTime.GetZoneAndDST[];
xxx ← ControlledUnpack[time, tp.zone, unspecified, tp.beginDST, tp.endDST];
The result can be converted to a rope by using Convert.RopeFromUnpackedTime
END.