Subject | Re: [firebird-support] Re: Problem with TIMESTAMP field precision |
---|---|
Author | Ivan Prenosil |
Post date | 2005-08-18T15:51:15Z |
> Why not use Trunc instead of Round then?Trunc() will not give desired results in many cases.
> timestamp_time := Trunc(IBTimeDivider*Abs(Frac(Value)));
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