[comp.sys.apple] REading Time on IIgs.

shatara@brutus.dec.com (Chris Shatara, 229-7740) (01/21/89)

RE:

>  I need to be able to read the exact time from the GS clock.  I bought
>  the firmware reference, hardware reference and programmers
>  introduction, but none of these manuals tell me how to read
>  hours:minutes:seconds.     I found how to read Hours:Minutes from an
>  old prodos manual, but I need seconds too.

From the Toolbox, the calls are either ReadHexTime or ReadAsciiTime. 
They are found in the Misc Tool Set pages 14-14 to 14-16 in the 
ToolBox reference manual (book1).

Both calls give you the current time including Month,Day,Year,Hour, 
Minutes, seconds.

What language do you want to use?  

In TML PASCAL I've used the following code
------------------------------------------------------------------

Function GetDateNTime:String;
var
    i : integer;
    TimeStr : packed array[0..19] of byte;
    TimeString : String[20]
begin
    TimeString := '';
    ReadAsciiTime(@TimeStr);
    for i := 0 to 19 do begin
        TimeStr[i] := BitAnd(TimeStr[i],$7F); {Strip off high order bit}
        TimeString := concat(TimeSting,chr(TimeStr[i]));
    end;
    GetDateNTime := TimeString;
end;

------------------------------------------------------------------

Hope this helps..

/chris shatara