Algorithm Math Delphi

Title: How to is a Time AM or PM
procedure AM_or_PM;
begin
if Frac(Time) = 0 then
ShowMessage('AM')
else
ShowMessage('PM');
end;