File information: | |
File name: | TimeConvert.mesa_Oct77.pdf [preview TimeConvert.mesa Oct77] |
Size: | 124 kB |
Extension: | |
Mfg: | xerox |
Model: | TimeConvert.mesa Oct77 🔎 |
Original: | TimeConvert.mesa Oct77 🔎 |
Descr: | xerox mesa 3.0_1977 listing TimeConvert.mesa_Oct77.pdf |
Group: | Electronics > Other |
Uploaded: | 25-12-2019 |
User: | Anonymous |
Multipart: | No multipart |
Information about the files in archive: | ||
Decompress result: | OK | |
Extracted files: | 1 | |
File name TimeConvert.mesa_Oct77.pdf timeconvert.mESA 24-0CT-77 18:55:07 Page 1 -- TimeConvert.Mesa Edited by Sandman on August 5, 1977 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: MonthTable: ARRAY [0 .. 12] OF CARDINAL = [0,31,60,91, 121, 152, 182, 213, 244, 274,305,335,366]: MonthNames: STRING = "JANFEBMARAPRMAYJUNJULAUGSEPOCTNOVDEC": 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: CARDINAL] RETURNS [PackedTime] BEGIN t: CARDINAL = a.lowbits; a. lowbits ~ a. lowbits + b; IF a.lowbits < t THEN a.highbits ~ a.highbits+l; RETURN[a] END; CurrentDayTime: PUBLIC PROCEDURE RETURNS [PackedTime] = BEGIN time: TYPE = MACHINE DEPENDENT RECORD [high,low: CARDINAL); clock: POINTER TO time = LOOPHOLE[572B); t: time = clock'!'; RETURN[PackedTillle[highbits: t.high, lowbits: t.low]) END; UnpackDT: PUBLIC PROCEDURE [t: PackedTime] RETURNS [unp: UnpackedTillle] BEGIN u: UP = @unp; day4, day. yr4: CARDINAL; month: CARDINAL ~ 1; IF t = Deraul tTime TIIrN t ~ CurrentDayTime[]; Ct. u.second] ~ DivideTime[t,60]; Ct. u.minute] ~ DivideTime[t,60]; Ct. u.houl'] ... DivideTime[t.24]: [t.day4] ... DivideTillle[t.DaysInrourYears]; y I' 4 ~ t. 1owb its: day4 ~ day4 + (Srl rCT day4 FROM )= 2*365+31+28 =) 3. )= 365+31+28 =) 2. )= 31+28 =) 1. rNDCASF =) 0); [day4. day] ... Inl illeDefs .DIVMOD[day4. 366]; u.year ... RoseVear + yr4*4 + doy4: WIIIl r clay )= ~lonthToble[lnontl1] DO month'" month + 1 ENDLOOP; timeconvert.mESA 24-0CT-77 18:55:07 Page 2 u.month ~ month ~ month-1: u.day ~ day - MonthTable[month]+1: insert daylight computation here u.dst ~ FALSE: RETURN END: InvalidTime: PUBLIC ERROR = CODE: PackDT: PUBLIC PROCEDURE [unp: UnpackedTime] RETURNS [t: PackedTime] BEGIN u: UP = @unp: year, month, day, day4, hour, minute, second: INTEGER: yr3: [0 .. 3]: IF (year ~ u.year-BaseYear) )= 176 OR (month ~ u.month) )=12 OR (day ~ u.day) -IN [0 .. 31] OR |
Date | User | Rating | Comment |