/*  --- University of Sussex POPLOG file -----------------------------------
 *  File:           $usepop/master/C.vms/plog/auto/date.pl
 *  Purpose:        get the time and date into a list
 *  Author:         Jonathan Laventhol, Jun 1983
 *  Documentation:  HELP * DATE
 *  Related Files:  UNIX version
 */

;;;    ?- time(X).
;;;    X = [24, jun, 1983, 19, 22, 27]

:- prolog_language("pop11").                   

define prolog_date();
vars s x;
    procedure(s);
    vars i;
        cons_with consstring
        {% for i from 1 to datalength(s)
           do  if lmember(s(i), [`:` `-`]) then ` `
               elseif isuppercode(s(i)) then s(i) + 32
               else s(i)
               endif
           endfor %}
    endprocedure(sysdaytime()).stringin.incharitem -> s;
    [% until (s() ->> x) == termin do x enduntil%]
enddefine;

:- prolog_language("prolog").

date(List) :-
    prolog_eval(apply(valof(prolog_date)), List).
