PACKAGE BODY CPUClock IS
------------------------------------------------------------------------
--| Body of CPUClock, suitable for Sun/Solaris.
--| Other Unix systems may be similar but not identical.
--| Author: Michael B. Feldman, The George Washington University
--| Last Modified: January 1996
------------------------------------------------------------------------
FUNCTION unixtime RETURN Integer;
PRAGMA Import (Convention => C, Entity => unixtime);
-- We are writing a little C function to get the time from Unix,
-- and importing it into this Ada package.
Saved_Time: Integer;
FUNCTION CPUTime RETURN CPUSecond IS
BEGIN
RETURN CPUSecond (unixtime - Saved_Time) / 60.0;
-- The division by 60 is because Unix is reporting the time in
-- 60th's of a second.
END CPUTime;
PROCEDURE ResetCPUTime IS
BEGIN
Saved_Time := unixtime;
END ResetCPUTime;
BEGIN -- initialization of package
ResetCPUTime;
END CPUClock;