Subject | Re: [firebird-support] TIMESTAMP arithmatic niggle |
---|---|
Author | Ivan Prenosil |
Post date | 2003-12-10T12:18:47Z |
From: "Lester Caine"
the best method is to do the integer math, unfortunately, it is not
directly possible in Firebird; you may however use UDF, e.g.
addMinute, addSecond etc. in fbudf.dll (written by Caludio).
Another good possibility is to do the math in double precision
(since you do not have to worry about number of decimal places), e.g.
DELETE = CURRENT_TIMESTAMP + (30 / 1440e0)
Ivan
> DELETE = CURRENT_TIMESTAMP + (30.0 / 1440.0) gives +30 minutesSince time is internally stored as integer (0.0001 sec precision),
> but
> DELETE = CURRENT_TIMESTAMP + (1.0 / 1440.0) does not give +1
> minute
>
> I would rather make the number of minutes an offset that the
> user can change, and do the arithmetic for them, but all
> attempts at times less then about 20 minutes 'round' to
> zero. Anybody see where I am going wrong?
the best method is to do the integer math, unfortunately, it is not
directly possible in Firebird; you may however use UDF, e.g.
addMinute, addSecond etc. in fbudf.dll (written by Caludio).
Another good possibility is to do the math in double precision
(since you do not have to worry about number of decimal places), e.g.
DELETE = CURRENT_TIMESTAMP + (30 / 1440e0)
Ivan