Subject | Re: [firebird-support] Re: TIMESTAMP arithmatic niggle |
---|---|
Author | Helen Borrie |
Post date | 2003-12-10T09:00:35Z |
At 08:43 AM 10/12/2003 +0000, you wrote:
actually seven places of scale in your result. The 59-second result here
is because 6 places cuts off the significant figures of 1 minute (.0006944)
at .000694. To get the full significant value of 1 minute the scales in
your operands need to be either 1.0000/1440.000 or 1.000/1440.0000..
/h
>--- In firebird-support@yahoogroups.com, Lester Caine wrote:Set wrote:
> > FB1.5 RC7
> >
> > I am moving some stuff from the client app into triggers for
> > use with PHP, and am having a little problem adding 'time'
> > to a TIMESTAMP. ( It works fine if done in Builder before
> > supplying to FB :) )
> >
> > DELETE = CURRENT_TIMESTAMP + 1 gives +24 hours
> >
> > DELETE = CURRENT_TIMESTAMP + 0.0007 gives +1 minute
> >
> > DELETE = CURRENT_TIMESTAMP + (30.0 / 1440.0) gives +30 minutes
> >
> > 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?
>Hi Lester!Correct, the problem is that to get the exact value of 1 minute, you
>If the limit had been 15 minutes rather than 20, that would have been
>where the time passed two decimals. I have not even tried Fb 1.5
>myself yet, but on Fb 1.0.2 I get one minute (or at least 59 second)
>added by using
>
>CURRENT_TIMESTAMP + (1.000 / 1440.000)
actually seven places of scale in your result. The 59-second result here
is because 6 places cuts off the significant figures of 1 minute (.0006944)
at .000694. To get the full significant value of 1 minute the scales in
your operands need to be either 1.0000/1440.000 or 1.000/1440.0000..
/h