<> <> <> <> <> <> DIRECTORY PrincOps USING [aRCLK, zMISC]; BasicTime: CEDAR DEFINITIONS = BEGIN <> OutOfRange: ERROR; <> <> <> <> <> TimeNotKnown: ERROR; <> TimeParametersNotKnown: ERROR; <> <<>> <> Pulses: TYPE = LONG CARDINAL; <> GetClockPulses: PROC RETURNS[Pulses] = TRUSTED MACHINE CODE { PrincOps.zMISC, PrincOps.aRCLK }; <> PulsesToMicroseconds: PROC[Pulses] RETURNS[LONG CARDINAL]; <> PulsesToSeconds: PROC[Pulses] RETURNS[REAL]; <> MicrosecondsToPulses: PROC[LONG CARDINAL] RETURNS[Pulses]; <<>> <> GMT: TYPE[2]; <<"GMT" provides a compact representation of a time, specified in seconds, which is efficient to obtain, to compare, and to modify.>> nullGMT: GMT = LOOPHOLE[LAST[INT]]; <> earliestGMT: GMT; <> latestGMT: GMT; <> Now: PROC RETURNS [GMT]; <> Period: PROC[from, to: GMT] RETURNS [INT]; <> Update: PROC[base: GMT, period: INT] RETURNS [GMT]; <> ToPupTime: PROC[GMT] RETURNS[LONG CARDINAL]; <> ToNSTime: PROC[GMT] RETURNS [LONG CARDINAL]; <> FromPupTime: PROC[LONG CARDINAL] RETURNS[GMT]; <> FromNSTime: PROC[LONG CARDINAL] RETURNS[GMT]; <> <> Unpacked: TYPE = RECORD[ <<"Unpacked" provides a representation of a time, specified in seconds, which is easy to interpret in ways meaningful to humans, such as years/months/days/etc. Each field has an default "unspecified" value for use by Time.SmartPack. >> year: [0..2050] _ 0, month: MonthOfYear _ unspecified, day: [0..daysPerMonth] _ 0, -- first day of the month is 1 hour: [0..hoursPerDay] _ 24, minute: [0..minutesPerHour] _ 60, second: [0..secondsPerMinute] _ 60, <> zone: Zone _ unspecifiedZone, dst: {yes, no, unspecified} _ unspecified, <> weekday: DayOfWeek _ unspecified, secondsThisYear: INT _ LAST[INT], daysThisYear: [0..daysPerYear] _ daysPerYear ]; MonthOfYear: TYPE = {January, February, March, April, May, June, July, August, September, October, November, December, unspecified}; DayOfWeek: TYPE = {Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday, unspecified}; Zone: TYPE = [-720..+721]; -- California is +60*8. 721 means unspecified. unspecifiedZone: Zone = +721; daysPerMonth: INT = 31; hoursPerDay: INT = 24; minutesPerHour: INT = 60; secondsPerMinute: INT = 60; daysPerYear: INT = 366; secondsPerYear: INT = secondsPerMinute * minutesPerHour * hoursPerDay * daysPerYear; Unpack: PROC[time: GMT] RETURNS[Unpacked]; <> Pack: PROC[unpacked: Unpacked] RETURNS[GMT]; <> <> ZoneAndDST: TYPE = RECORD[ zone: Zone, beginDST, endDST: [0..366] -- DST starts/stops at 2 a.m. ]; SetZoneAndDST: PROC[ZoneAndDST]; <> GetZoneAndDST: PROC RETURNS[ZoneAndDST]; <> SetTime: PROC; <> END.