With Util; -- Hi and Lo are used in here Package Body Timelib Is -- Time Library - Get the current time and date -- -- Not implemented for CP/M-80 - user may add their own implementation -- Last modified 9/ 7/82 -- Copyright 1982 RR Software, P.O. Box 1512, Madison WI 53701 -- Permission is hereby given to distribute Object Code produced from -- these libraries. Use Util; time1,time2 : Integer; -- Local temporary variables Function get_time Return Time Is -- Get and return the current time temp : time; Begin Put("Get_time not implemented - User must implement"); New_Line; temp.hours := 12; temp.minutes := 0; temp.seconds := 0; temp.fract := 0; Return Temp; End get_time; Function get_date Return Date Is -- Get and return the current date temp : date; Begin Put("Get_date not implemented - User must implement"); New_Line; temp.year := 1982; temp.month := 9; temp.day := 7; Return Temp; End get_date; Procedure put_date(fyle : In file; day : date) Is -- Put the date to the file Begin Case day.month Is When 1 => Put(fyle,"January "); When 2 => Put(fyle,"February "); When 3 => Put(fyle,"March "); When 4 => Put(fyle,"April "); When 5 => Put(fyle,"May "); When 6 => Put(fyle,"June "); When 7 => Put(fyle,"July "); When 8 => Put(fyle,"August "); When 9 => Put(fyle,"September "); When 10 => Put(fyle,"October "); When 11 => Put(fyle,"November "); When 12 => Put(fyle,"December "); When Others => Put(fyle,"** Bad Date ** "); End Case; Put(fyle,day.day); Put(fyle,", "); Put(fyle,day.year); End put_date; Procedure put_time(fyle : In file; clk : time) Is -- Put the time to the file Begin Put(fyle,clk.hours); Put(fyle,":"); If clk.minutes In 0..9 Then Put(fyle,'0'); End If; Put(fyle,clk.minutes); Put(fyle,":"); If clk.seconds In 0..9 Then Put(fyle,'0'); End If; Put(fyle,clk.seconds); Put(fyle,"."); If clk.fract In 0..9 Then Put(fyle,'0'); End If; Put(fyle,clk.fract); End put_time; Function elapsed_time(start,finish : Time) Return Time Is -- Figure the elapsed time between start and finish temp : time; Begin temp.hours := finish.hours - start.hours; temp.minutes := finish.minutes - start.minutes; temp.seconds := finish.seconds - start.seconds; temp.fract := finish.fract - start.fract; If temp.hours >= 0 Then -- adjust so all fields are positive If temp.fract < 0 Then temp.fract := temp.fract + 100; temp.seconds := temp.seconds - 1; End If; If temp.seconds < 0 Then temp.seconds := temp.seconds + 60; temp.minutes := temp.minutes - 1; End If; If temp.minutes < 0 Then temp.minutes := temp.minutes + 60; temp.hours := temp.hours - 1; End If; If temp.hours < 0 Then Put("*Error* Negative time elapsed"); New_Line; End If; Else Put("*Error* Negative time elapsed"); New_Line; End If; Return temp; End elapsed_time; End Timelib; s := temp.seconds + 60; temp.minutes := temp.minutes - 1; End If; If temp.minutes < 0 Then temp.minutes := temp.minutes + 60; temp.hours := temp.hours - 1; End If; If temp.hours < 0 Then Put("*Error* Negative time elapsed"); New_Line; End If; Else Put("*Error* Negative time elapsed"); New_Line; End If; Return temp; End elapse temp.fract := temp.fract + 100; temp.seconds := temp.seconds - 1; End If; If temp.seconds < 0 Then temp.secon