-- DateAndTime.mesa
-- last edited by Brotz on August 18, 1982 4:39 PM
-- last edited by Levin on June 8, 1982 10:54 am
DIRECTORY
TimeDefs USING [PackedTime];
DateAndTime: DEFINITIONS =
BEGIN
Notes: TYPE = {normal, noZone, zoneGuessed, noTime, timeAndZoneGuessed};
Parse: PROCEDURE [s: STRING] RETURNS [dt: TimeDefs.PackedTime, notes: Notes];
-- This procedure parses the input string and returns a GMT time according to the Pilot
-- standard. (Note: This value is suitable without conversion as a Time.Packed.) The
-- ’notes’ return value is interpreted as follows: ’normal’ means the value returned is
-- unambiguous, ’noZone’ means that a time-of-day was present, but without a zone
-- indication (the local time zone as provided by System.LocalTimeParameters is assumed),
-- ’zoneGuessed’ is returned instead of ’noZone’ if local time parameters are not available,
-- and the zone is assumed to be Pacific Time (standard or daylight time is determined by
-- the date). ’noTime’ and ’timeAndZoneGuessed’ are equivalent to ’noZone’ and
-- ’zoneGuessed’, respectively, where the time is assumed to be 00:00:00 (local midnight). If
-- the input can’t be reasonably interpreted as a date, Unintelligible is raised.
-- Syntax: the date is generally assumed to precede the time, although if the time precedes
-- the date it will usually be properly recognized. The date syntax is a somewhat less
-- restrictive version of RFC733; full RFC733 is recognized, plus forms like "month day,
-- year", "mm/dd/yy", and variations with Roman numerals used for the month. The form
-- "year month day" is also accepted if the year is a full 4-digit quantity. Forms with
-- "-" instead of significant space are also acceptable, as well as forms in which a delimiter
-- (space or "-") can be elided without confusion. The time is generally assumed to be
-- in RFC733 format, with the zone specification appearing exactly as defined in that
-- document. In addition, "am" or "pm" may optionally appear following the time (but
-- preceding the zone, if any).
Unintelligible: ERROR;
END.