Received: from localhost (IDENT:root@hectic-2.jpl.nasa.gov [128.149.68.204]) by hub.org (8.9.3/8.9.3) with ESMTP id BAA17943 for ; Sat, 14 Aug 1999 01:25:52 -0400 (EDT) (envelope-from lockhart@alumni.caltech.edu) Received: from alumni.caltech.edu (lockhart@localhost [127.0.0.1]) by localhost (8.8.7/8.8.7) with ESMTP id FAA09886; Sat, 14 Aug 1999 05:25:15 GMT Sender: lockhart@hub.org Message-ID: <37B4FDBB.AE4D04A2@alumni.caltech.edu> Date: Sat, 14 Aug 1999 05:25:15 +0000 From: Thomas Lockhart X-Mailer: Mozilla 4.6 [en] (X11; I; Linux 2.0.36 i686) X-Accept-Language: en MIME-Version: 1.0 To: Gene Sokolov CC: pgsql-interfaces@hub.org Subject: Re: [INTERFACES] ODBC (6.40.0006): SQL_TIME binary format (bug? feature?) References: <02ae01bee490$81251ff0$0d8cdac3@aktrad.ru> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit > I have a table (PGSQL 6.5.0): > CREATE TABLE TimePeriods ( > ID SERIAL PRIMARY KEY , > MarketID INT NOT NULL REFERENCES Markets , > WeekDay INT NOT NULL , /* 1-7, Sun-Mon */ > TimeOpen TIME NOT NULL , > TimeClose TIME NOT NULL > ); > The TimeOpen and TimeClose are stored as 4 byte values in the database. ?? The TIME type is stored internally as a double precision float afaik. > the ODBC driver returns them as 8 byte values in a completely unexpected > format! The usual binary representation of an SQL_TIME is (high to low) 1 > byte hours, 1 byte minutes, 1 byte seconds and the lowest byte 1/100s of a > second. Usual where? > Here I get (low to high): int16 hours, int16 minutes, int16 seconds, and > int16 0xCDCD. The result - 1/100s are lost and a lot of wasted network > bandwidth. What is the point of formatting TIME like that? Why does it clip > fractions of a second? Is it a bug or a feature? If it's a bug, how can I > help fixing it? If it's a feature, why is it needed? I'm not sure where int16 is coming from. Is it the case that the ODBC driver must return TIME fields in this format? You seem to think not, so without looking at the code I have no explanation. - Thomas -- Thomas Lockhart lockhart@alumni.caltech.edu South Pasadena, California