Subject Re: [firebird-support] Strange timestamp math w/ FB 2.5
Author Paul Vinkenoog
Kjell Rilbe wrote:

>> Did you happen to notice the OP was asking about why his timestamp
>> math wasn't giving him the result he expected, not about how to use
>> datetime functions?
>
> Yes, I noticed. But I thought it might be relevant for what he's
> trying to do to find an alternative method, since apparently a
> simple subtraction doesn't give enough precision to measure seconds,
> which I perceive he needs.

The subtraction result is precise enough, but Rick stores it in a
decimal(18,4), so the precision becomes 8,64 sec (1/10000 of a day).

Multiplication by 86400 before storing the result in the var gives
millisecond precision (the fourth digit after the decimal point is
meaningless: 'NOW' has milliseconds precision).

Of course using datediff([milli]second, t0, t1) is easier and
clearer.


Cheers,
Paul Vinkenoog