Re: time stamp granularity issue in Oracle

From: Thomas Kyte <tkyte_at_us.oracle.com>
Date: 1997/11/07
Message-ID: <346749a7.13874280_at_newshost>#1/1


Unfortunately, that won't work exactly right. You'll get milliseconds but the milliseconds won't correspond to the system clock (v$timer has a mind of its own. Its very usful for measuring elapsed time but not for telling the time)....

If you change the query to be:

  1 begin

  2      for i in 1 .. 20 loop
  3          for x in ( select to_char(sysdate,'HH24:MI:SS') || '.' ||
  4                       lpad(mod(hsecs,100),2,'0') t from v$timer ) loop
  5              dbms_output.put_line( x.t );
  6          end loop;
  7      end loop;

  8* end;

You'll see stuff like:

...

11:55:26.99
11:55:26.99
11:55:26.99   ---> problem
11:55:26.00   ---> problem
11:55:26.00
11:55:26.00
11:55:26.00
11:55:26.01
11:55:26.01
11:55:26.01

...

or
...

11:58:53.96
11:58:53.97
11:58:53.97
11:58:53.97
11:58:53.97  --> problem
11:58:54.98  --> problem
11:58:54.98
11:58:54.98
11:58:54.98
11:58:54.99

...

the clock in v$timer is just a ticker that counts hundredth's of seconds from some arbitrary epoch in time. It doesn't roll over to a mod of 100 every second with the system clock tho.

On Thu, 06 Nov 1997 22:12:40 -0600, Frank Hubeny <fhubeny_at_ntsource.com> wrote:

>Time is presented in hundredths of a second in V$TIMER. Perhaps, something like
>the following might be useful:
>
> select to_char(sysdate,'HH24:MI:SS') || '.' || lpad(mod(hsecs,100),2,'0')
>from v$timer;
>
>
>L. Tseng wrote:
>
>> Why? Is it too hard to do?
>>
>> In article <01bce9f9$6bfa1010$54110b87_at_clamagent>,
>> Dan Clamage <clamage_at_mime.dw.lucent.com> wrote:
>> >> How about I need to get microseconds?
 Can't.
>> >> How can I get around this in Oracle?
>> >You could build a clock server in C and pass a string via a pipe with the
>> >correct time in microseconds, but by the time you get it, it won't be very
>> >accurate.
>> >> Does anyone know Oracle will increase the DATE granularity in the near
>> >future?
>> >I'm quite sure they have no plans (or interest) in modifying their internal
>> >date format in this direction.
>> >-djc
>>
>> --
>> =-=-=-=-=-=-=-=-=-=-=
>> Leslie Tseng
>> lesliet_at_writeme.com
>> =-=-=-=-=-=-=-=-=-=-=
>
 

Thomas Kyte
tkyte_at_us.oracle.com
Oracle Government
Bethesda MD  

http://govt.us.oracle.com/ -- downloadable utilities  



[Quoted] Opinions are mine and do not necessarily reflect those of Oracle Corporation  

Anti-Anti Spam Msg: if you want an answer emailed to you, you have to make it easy to get email to you. Any bounced email will be treated the same way i treat SPAM-- I delete it. Received on Fri Nov 07 1997 - 00:00:00 CET

Original text of this message