Subject | Re: Strange timestamp math w/ FB 2.5 |
---|---|
Author | hvlad |
Post date | 2010-10-20T19:12:25Z |
--- In firebird-support@yahoogroups.com, "Rick Debay" <rdebay@...> wrote:
Regards,
Vlad
>TIMESTAMP's difference measured in days ;) So, multiply the difference by number of seconds per day and you'll get difference in seconds. Or use DATEDIFF built-in function.
> I'm trying to do performance tracing and I'm getting strange numbers. A
> stored procedure that runs for over sixteen seconds is being logged as
> running for 0.0002 seconds.
> Does anyone have any ideas as to what I could be doing wrong?
>
> CREATE TABLE PERF_TRACE
> (
> PROC VARCHAR(32) NOT NULL,
> DURATION DECIMAL(18,4) NOT NULL,
> CONSTRAINT PK_PERF_TRACE PRIMARY KEY (PROC)
> );
>
> PROC DURATION
> --------------
> TEST 0.0000
>
> DECLARE VARIABLE STRT TIMESTAMP;
> ...
> STRT=CAST('NOW' AS TIMESTAMP);
> /* runs for 16.703 seconds */
> UPDATE PERF_TRACE p SET p.DURATION = p.DURATION + (CAST('NOW' AS
> TIMESTAMP) - :STRT) WHERE p.PROC='TEST';
>
> PROC DURATION
> --------------
> TEST 0.0002
Regards,
Vlad