Can not compile UDF library (by Gregory Deatz) in Delphi 4

Hello, I have two problems:

1. Every time I try to compile the UDF-Library of Gregory Deatz, I get a lot
of Errors.
One is in the File MISC.PAS,
Line "WriteFile(hOutput, szConsoleMsg, StrLen(szConsoleMsg), BytesWritten,
Error-Message (translated from German:) "The types of real parameters and
VAR parameters should match"

2. In normal SQL it is not possible to SUM UP or get AVERAGE of date-Fields.
Is there a UDF Function (for Free) ?
Or, I want to write a UDF in Delphi 4 on my own:
It shall get a time in seconds (at all) from InterBase-Column and split this
in hours,minutes and seconds and then return this as InterBase-date for use
in SQL.
The function looks like this, in that case it gives You a TDateTime;

function SecondsToTime(secs: Integer): TDateTime;
var hh,mm,ss: Word;
     hh:=secs div 3600;
     mm:=secs div 60;

Thank You for Your help.