{Begin SubSec Date/Time Functions}
{Title Date/Time Functions}
{Text

{FnDef {FnName DATE} {FnArgs FORMATBITS}
{Text
Obtains date and time, returning it as a single string with format
{lisp "{arg DD}-{arg MM}-{arg YY} {arg HH}:{arg MMM}:{arg SS}"}, where {arg DD} is day, {arg MM} is month, {arg YY} year, {arg HH} hours, {arg MMM} minutes, {arg SS} seconds,
e.g., {lisp "14-MAY-71 14:26:08"}.

In Interlisp-10, {fn DATE} will accept {arg FORMATBITS} as an argument, which can be used to specify other formats, e.g., day of week, time zone, etc., as described in the TENEX/TOPS-20 JSYS manual. {arg FORMATBITS} is ignored in Interlisp-D.
}}



{FnDef {FnName IDATE} {FnArgs STR}
{Text
{arg STR} is a date and time string.  Value of {fn IDATE} is {arg STR} converted to a number such that if {arg DATE{sub 1}} is before (earlier than) {arg DATE{sub 2}}, then {lisp (IDATE {arg DATE{sub 1}})} < {lisp (IDATE {arg DATE{sub 2}})}.  {lisp (IDATE)} returns {lisp (IDATE (DATE))}.

Note that different Interlisp implementations can have different internal date formats.  In fact, Tenex and Tops-20 have different internal date formats, even within Interlisp-10.  {fn IDATE} still has the essential property that {lisp (IDATE {arg X})} is less than {lisp (IDATE} {arg Y}) if {arg X} is before {arg Y}, and {lisp (IDATE (GDATE {arg N}))} equals {arg N}.  Programs which do arithmetic other than numerical comparisons between {fn IDATE} numbers may not port from one implementation to another.

Generally, it is possible to increment an {fn IDATE} number by an integral number of days by computing a "1 day" constant, the difference between two convenient {lisp IDATE's}, e.g. {lisp (IDIFFERENCE (IDATE " 2-JAN-80 12:00") (IDATE " 1-JAN-80 12:00"))}.  This "1 day" constant can be evaluated at compile time.

{fn IDATE} is guaranteed only to accept as input the dates that {fn DATE} will output.
}}



{FnDef {FnName GDATE} {FnArgs DATE FORMATBITS -}
{Text
Like {fn DATE}, except that {arg DATE} can be a number in internal date-and-time format as returned by {fn IDATE}.  If {lisp NIL}, the current time and date is used, i.e. the value of {lisp (IDATE)}.
}}



{FnDef {FnName CLOCK} {FnArgs N {anonarg}}
{Text
{Begin LabeledList CLOCK}

{Indent 17percent}

{Label For {arg N}=0,}
{Item
returns the current value of the time of day clock i.e., number of milliseconds since last system start up.
}

{Label For {arg N}=1,}
{Item
returns the value of the time of day clock when the user started up this Interlisp, i.e., difference between {lisp (CLOCK 0)} and {lisp (CLOCK 1)} is number of milliseconds (real time) since this Interlisp was started.
}

{Label For {arg N}=2,}
{Item
returns the number of milliseconds of {it compute} time since user started up this Interlisp (garbage collection time is subtracted off).
}

{Label For {arg N}=3,}
{Item
returns the number of milliseconds of compute time spent in garbage collections (all types).{foot
In Interlisp-10, this  number is directly accessible via the 
{lisp COREVAL} {lisp GCTIM}.
}{comment endfootnote}
}

{End LabeledList CLOCK}
}}


}{End SubSec Date/Time Functions}