Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Timestamp Fractional Seconds

Re: Timestamp Fractional Seconds

From: geoff <nospam_at_nospam.com>
Date: Thu, 12 Jul 2007 17:53:55 GMT
Message-ID: <TUtli.32608$mZ7.31199@fe01.news.easynews.com>


First, it should be pointed out that solaris sparc is big endian, and windows pc's are little endian.

I am up to IBM Smalltalk now, which runs on both machines. The sql statement executed was (the table is in the first msg.):

Select * From tt where id = 1

. . . it was prepared and executed the normal way using OCI functions. The bytes returned were:

AbtForeignOSObject [15] {
*AbtForeignOSObject {[1]}
*AbtForeignOSObject {[0]}
*AbtForeignOSObject {[0]}
*AbtForeignOSObject {[0]}
*AbtForeignOSObject {[120]}
*AbtForeignOSObject {[107]}
*AbtForeignOSObject {[5]}
*AbtForeignOSObject {[21]}
*AbtForeignOSObject {[11]}
*AbtForeignOSObject {[24]}
*AbtForeignOSObject {[46]}
*AbtForeignOSObject {[7]}
*AbtForeignOSObject {[84]}
*AbtForeignOSObject {[212]}
*AbtForeignOSObject {[192]}}

. . . the code to convert the above bytes to a date is:

 date := (Date

     newDay: (data uint8At: (baseOffset + 3))
     month: (Date nameOfMonth: (data uint8At: (baseOffset + 2)))
     year: ((((data uint8At: (baseOffset + 0)) - 100) * 100) + ((data 
uint8At: (baseOffset + 1)) - 100))
     ).

 time := (Time new
     hours: (( data uint8At: ( baseOffset + 4 )) - 1 )
     minutes: (( data uint8At: ( baseOffset + 5 )) - 1 )
     seconds: (( data uint8At: ( baseOffset + 6 )) - 1 )
     ).


. . . baseOffset is 4, which is '120' in the above bytes. The fractional seconds are obtained by reversing the last four bytes, '7, 84, 212, 192' and reading them as a word (32-bits).

-g Received on Thu Jul 12 2007 - 12:53:55 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US