[pgsqlclient-checkins] pgsqlclient_10/PostgreSql.Data.PgSqlClient/source/NPgClient PgOutputPacket.cs
Status: Inactive
Brought to you by:
carlosga_fb
From: <car...@us...> - 2003-10-28 10:46:23
|
Update of /cvsroot/pgsqlclient/pgsqlclient_10/PostgreSql.Data.PgSqlClient/source/NPgClient In directory sc8-pr-cvs1:/tmp/cvs-serv17199 Modified Files: PgOutputPacket.cs PgResponsePacket.cs Log Message: 2003-10-28 Carlos Guzmán Álvarez <car...@te...> * source/NPgClient/PgOutputPacket.cs: * source/NPgClient/PgResponsePacket.cs: - Added fix for correct handling of timetz type. Index: PgOutputPacket.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/PostgreSql.Data.PgSqlClient/source/NPgClient/PgOutputPacket.cs,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** PgOutputPacket.cs 27 Oct 2003 12:25:21 -0000 1.16 --- PgOutputPacket.cs 28 Oct 2003 10:44:55 -0000 1.17 *************** *** 167,171 **** this.WriteDouble(seconds.TotalSeconds); ! this.WriteInt(0); } --- 167,171 ---- this.WriteDouble(seconds.TotalSeconds); ! this.WriteInt((-1)*Int32.Parse(time.ToString("zz"))*3600); } *************** *** 179,185 **** public void WriteTimestampWithTZ(DateTime timestamp) { ! TimeSpan days = timestamp.Subtract(PgCodes.BASE_DATE); ! ! this.WriteDouble(days.TotalSeconds); } --- 179,183 ---- public void WriteTimestampWithTZ(DateTime timestamp) { ! this.WriteTimestamp(timestamp); } Index: PgResponsePacket.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/PostgreSql.Data.PgSqlClient/source/NPgClient/PgResponsePacket.cs,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** PgResponsePacket.cs 27 Oct 2003 18:46:49 -0000 1.17 --- PgResponsePacket.cs 28 Oct 2003 10:44:55 -0000 1.18 *************** *** 240,252 **** int timezone = (-1)*(this.ReadInt()/3600); ! string format = "{0:D2}{1}{2:D2}{3}{4:D2}{5}"; ! if (timezone > 0) { ! format = "{0:D2}{1}{2:D2}{3}{4:D2}+{5}"; } StringBuilder timeWithTZ = new StringBuilder(); timeWithTZ.AppendFormat( ! format, time.Hour, CultureInfo.CurrentCulture.DateTimeFormat.TimeSeparator, --- 240,252 ---- int timezone = (-1)*(this.ReadInt()/3600); ! string sbFormat = "{0:D2}{1}{2:D2}{3}{4:D2}{5:D2}"; ! if (timezone >= 0) { ! sbFormat = "{0:D2}{1}{2:D2}{3}{4:D2}+{5:D2}"; } StringBuilder timeWithTZ = new StringBuilder(); timeWithTZ.AppendFormat( ! sbFormat, time.Hour, CultureInfo.CurrentCulture.DateTimeFormat.TimeSeparator, *************** *** 256,261 **** timezone); ! return DateTime.Parse( timeWithTZ.ToString(), CultureInfo.CurrentCulture.DateTimeFormat, DateTimeStyles.NoCurrentDateDefault | --- 256,272 ---- timezone); ! StringBuilder format = new StringBuilder(); ! format.AppendFormat( ! "{0}{1}{2}{3}{4}{5}", ! "HH", ! CultureInfo.CurrentCulture.DateTimeFormat.TimeSeparator, ! "mm", ! CultureInfo.CurrentCulture.DateTimeFormat.TimeSeparator, ! "ss", ! "zz"); ! ! return DateTime.ParseExact( timeWithTZ.ToString(), + format.ToString(), CultureInfo.CurrentCulture.DateTimeFormat, DateTimeStyles.NoCurrentDateDefault | |