-------- SIMTEL20 Ada Software Repository Prologue ------------ -- -* -- Unit name : package TOD_Utilities -- Version : 1.0 (MOOV115) -- Author : Geoffrey O. Mendal -- : Stanford University -- : Computer Systems Laboratory -- : Stanford, CA 94305 -- : (415) 497-1414 or 497-1175 -- DDN Address : Mendal@SU-SIERRA.ARPA -- Copyright : (c) 1985 Geoffrey O. Mendal -- Date created : Mon 11 Nov 85 -- Release date : Sun 25 Dec 85 -- Last update : MENDAL Sun 25 Dec 85 -- Machine/System Compiled/Run on : DG MV10000, ROLM ADE -- VAX 11/780, DEC ACS -- RATIONAL R1000 -- Dependent Units : package CALENDAR -- generic package Search_Utilities -- -* --------------------------------------------------------------- -- -* -- Keywords : TIME ----------------: DAY ----------------: DATE ----------------: TIME CONVERSION ----------------: DATE CONVERSION -- -- Abstract : This package contains time-of-day conversion ----------------: routines. One routine takes practically ----------------: any time/date STRING and converts it to ----------------: CALENDAR.TIME format. The other routine takes ----------------: a CALENDAR.TIME value and converts it to a ----------------: STRING containing the day name, full date, ----------------: and time (resolution to the nearest second). -- -* ------------------ Revision history --------------------------- -- -* -- DATE VERSION AUTHOR HISTORY -- 12/29/85 1.0 (MOOV115) Mendal Initial Release -- -* ------------------ Distribution and Copyright ----------------- -- -* -- This prologue must be included in all copies of this software. -- -- This software is copyright by the author. -- -- This software is released to the Ada community. -- This software is released to the Public Domain (note: -- software released to the Public Domain is not subject -- to copyright protection). -- Restrictions on use or distribution: NONE -- -* ------------------ Disclaimer --------------------------------- -- -* -- This software and its documentation are provided "AS IS" and -- without any expressed or implied warranties whatsoever. -- No warranties as to performance, merchantability, or fitness -- for a particular purpose exist. -- -- Because of the diversity of conditions and hardware under -- which this software may be used, no warranty of fitness for -- a particular purpose is offered. The user is advised to -- test the software thoroughly before relying on it. The user -- must assume the entire risk and liability of using this -- software. -- -- In no event shall any person or organization of people be -- held responsible for any direct, indirect, consequential -- or inconsequential damages or lost profits. -- -* -------------------END-PROLOGUE-------------------------------- -- This package will provide direct conversion from an external -- time/date string to the internal Ada CALENDAR.TIME representation -- and visa versa. Most free format external representations are -- supported. Components of an external format include: -- Year, Month and Day (as numbers and strings), Hour, Minutes, -- and Seconds -- As long as the external representation can be parsed unambiguously, -- this package should be able to handle the conversion. Examples of -- valid external formats: -- 7pm Fr March 12, 1982 -- 15 Dec. 84 12:36PM -- YESTERDAY 3PM -- 6/01/83 <-- defaults to 12:00:00AM -- 3:45AM <-- defaults to the current date -- 18:07:35 <-- defaults to the current date -- 8-26 <-- defaults to 12:00:00AM of the current year -- friday <-- defaults to 12:00:00AM of the current or next -- future Friday -- Examples of invalid external representations: -- 2/31/84 <-- February never has a 31st day -- 12:3605/01/84 <-- too tough to parse (nondeterminstic) -- 3/8423:00:00 <-- too tough to parse (nondeterminstic) -- 3:54:29AMTues <-- too tough to parse (nondeterminstic) -- Nov 1983 <-- must always include day number in the date -- Sun 8/3/84 <-- 8/3/84 was a Friday -- Optional periods may be placed after ABBREVIATED day/month names. -- All external formats are converted to upper case, so there are no -- problems with specifying mixed and/or lower case input. All -- results are returned in upper case by default (which can be overridden -- by specifying lower case or mixed case). -- Special external formats: TODAY, TOMORROW, YESTERDAY, NOW -- TODAY is equivalent to 12AM of the current date. TOMORROW and -- YESTERDAY are equivalent to the next/previous date. NOW is -- equivalent to calling the function CALENDAR.CLOCK . -- Defaults: -- If the year is omitted, it defaults to the current year. If the -- time is omitted, it defaults to 12:00:00AM. If the day name and no -- date is specified, the current or next future date is assumed. If -- only the time is specified, the current date is assumed. If the -- minutes and/or seconds are not specified in the time, they default -- to zero. If the year is given in short format (1 or 2 digits) then -- it defaults to the current century. -- BNF for the external representation: -- { [