Page Numbers: Yes First Page: 79 X: 527 Y: 10.5"
Margins: Binding: 13
Odd Heading:
Alto/Mesa Time Package
Even Heading: Not-on-first-page
Alto/Mesa Time Package
Alto/Mesa Time Package
October 1980
This section describes procedures that implement various operations on dates and times. The necessary TYPE and PROCEDURE declarations appear in TimeDefs and are described below.
PackedTime: TYPE = LONG CARDINAL;
A PackedTime is the number of seconds since midnight January 1, 1901 GMT.
DefaultTime: PackedTime;
UnpackedTime: TYPE = RECORD [
year: [0..2050],-- years less than 1901 are not possible
month: [0..12),-- January = 0
day: [0..31],-- first day of month = 1
hour: [0..24),
minute: [0..60),
second: [0..60),
weekday: [0..6],-- Monday = 0
zone: [-12..12],-- Pacific = 8
dst: BOOLEAN];
CurrentDayTime: PROCEDURE RETURNS [time: PackedTime];
Returns the current date and time in packed format.
UnpackDT: PROCEDURE [PackedTime] RETURNS [time: UnpackedTime];
Converts a packed format time to a more convenient unpacked format. If the argument is DefaultTime, the current time is used.
PackDT: PROCEDURE [unp: UnpackedTime, computeDST: BOOLEAN ← TRUE]
RETURNS [time: PackedTime];
Converts unp into packed format. If computeDST is TRUE, the time zone and daylight savings time are computed according to local conventions rather than taken from unp. If any of the fields of unp contain illegal values, PackDT will signal InvalidTime.
InvalidTime: ERROR;
PackDT has discovered illegal values in the unpacked time.
AppendDayTime: PROCEDURE [s: STRING, u: UnpackedTime, zone: BOOLEAN ← FALSE];
Converts u to a text string of the form 12-Jan-78 14:56:13 and appends it to s. If zone is TRUE then the time zone is included, e.g. 1-May-78 14:56:13 PDT.
AppendFullDayTime: PROCEDURE [s: STRING, u: UnpackedTime] = INLINE
{
AppendDayTime[s: s, u: u, zone: TRUE]};
RealTimeClock: POINTER TO CARDINAL = -- magic location --;
Defines the location of the Alto Real Time Clock. See Alto: A Personal Computer System; Hardware Manual.
ReadClock: PROCEDURE RETURNS [LONG UNSPECIFIED];
Returns the high resolution clock. The format of the result is machine dependent.