Re: Sysdate time-resolution ?

From: Thomas J. Kyte <tkyte_at_us.oracle.com>
Date: 1996/08/12
Message-ID: <320f5ace.10432050_at_dcsun4>#1/1


On Mon, 12 Aug 1996 10:47:56 -0700, "Brian P. Mac Lean" <brian.maclean_at_teldta.com> wrote:

>Alexander Moan wrote:
>>
>> -snip-
>>
>> Is it possible to get 100.s and 1000.s of a second out of to_char or anyting
>> else ?
>>
>> Alexander Moan --:-) moan_at_sn.no
>
>
>
>
>I stole this from someone who stole it from someone else. You should be able to modify it to your needs.
>
>
>SQL> select to_char(sysdate,'DD-MON-YYYY hh24:mi:ss:' ) || mod(hsecs,100) from v$timer;
>
>TO_CHAR(SYSDATE,'DD-MON-YYYYHH24:MI:SS.')||MOD(HSECS,100)
>--------------------------------------------------------------------------------
>12-AUG-1996 10:33:14.49
>
>
>
>
>brian.maclean_at_teldta.com
>
>"The secret to creativity is knowing how to hide your sources."
> Albert Einstein

Unfortunately I started this bad habit.

The problem is the value in v$timer at the level of hsecs but from some arbritrary point in time. The clock in v$timer is NOT in sync with the clock used by SYSDATE. (well you have a 1 in 100 chance of them being in sync).

Basically you can get times like:

12-AUG-1996 10:33:14.49
12-AUG-1996 10:33:14.76
12-AUG-1996 10:33:15.90
12-AUG-1996 10:33:15.15
12-AUG-1996 10:33:15.40

(eg: they are not increasing all the time, the SYSDATE clock rolled over to 15 seconds before the v$timer clock does).

Sorry for starting this confusion......

Thomas Kyte
Oracle Government
tkyte_at_us.oracle.com                          

http://govt.us.oracle.com -- Check out our web site! Brand new, uses Oracle Web Server and Database


statements and opinions are mine and do not necessarily reflect the opinions of Oracle Corporation Received on Mon Aug 12 1996 - 00:00:00 CEST

Original text of this message