Trimming ten-thousandths of a second during TIMESPAN conversion to the DateTime 
in the NET Provider for Firebird.
-----------------------------------------------------------------------------------------------------------------

                 Key: DNET-654
                 URL: http://tracker.firebirdsql.org/browse/DNET-654
             Project: .NET Data provider
          Issue Type: Bug
          Components: ADO.NET Provider
    Affects Versions: 4.7.0.0
         Environment: Windows 10, 64-bit
            Reporter: Kamil Kocian
            Assignee: Jiri Cincura


The NET Provider for Firebird trims ten-thousandths of a second during TIMESPAN 
conversion to the .NET DateTime type in method TypeDecoder.DecodeTime(int 
sql_time). Trimming the ten-thousandths of a second is causing problem when 
comparing time read from Firebird to .NET and using the value again in SQL 
statements. 

However it is possible to initialize .NET type DateTime(or TimeSpan) with 
number of ticks, this way keeping the precision of Firebird TIMESTAMP in .NET. 

Problematic source code in 
FirebirdSql.Data.FirebirdClient\Common\TypeDecoder.cs :
public static TimeSpan DecodeTime(int sql_time)
{
        int millisInDay = sql_time / 10;
        int hour = millisInDay / 3600000;
        int minute = (millisInDay - hour * 3600000) / 60000;
        int second = (millisInDay - hour * 3600000 - minute * 60000) / 1000;
        int millisecond = millisInDay - hour * 3600000 - minute * 60000 - 
second * 1000;

        return new TimeSpan(0, hour, minute, second, millisecond);
}

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

------------------------------------------------------------------------------
Go from Idea to Many App Stores Faster with Intel(R) XDK
Give your users amazing mobile app experiences with Intel(R) XDK.
Use one codebase in this all-in-one HTML5 development environment.
Design, debug & build mobile apps & 2D/3D high-impact games for multiple OSs.
http://pubads.g.doubleclick.net/gampad/clk?id=254741911&iu=/4140
_______________________________________________
Firebird-net-provider mailing list
Firebird-net-provider@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/firebird-net-provider

Reply via email to