Subject Re: [firebird-support] Re: Problem with TIMESTAMP field precision
Author Ivan Prenosil
> Why not use Trunc instead of Round then?
> timestamp_time := Trunc(IBTimeDivider*Abs(Frac(Value)));

Trunc() will not give desired results in many cases.
Better use this:

function TimeToFBTime(Value: TDateTime): Integer;
const
FBTicksPerDay = 24*60*60*10000;
begin
Result := Round(Abs(Frac(Value)) * FBTicksPerDay);
if Result >= FBTicksPerDay then
Result := FBTicksPerDay - 1;
end;

Ivan