<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Wed Feb 07 21:35:50 UTC 2024

It is possible to restrict the fields that are returned in this document by specifying the 'field' parameter in your request.
For example, to request only the issue key and summary append 'field=key&field=summary' to the URL of your request.
-->
<rss version="0.92" >
<channel>
    <title>MongoDB Jira</title>
    <link>https://jira.mongodb.org</link>
    <description>This file is an XML representation of an issue</description>
    <language>en-us</language>    <build-info>
        <version>9.7.1</version>
        <build-number>970001</build-number>
        <build-date>13-04-2023</build-date>
    </build-info>


<item>
            <title>[CSHARP-114] DateTime data types are off by a few ticks</title>
                <link>https://jira.mongodb.org/browse/CSHARP-114</link>
                <project id="10041" key="CSHARP">C# Driver</project>
                    <description>&lt;p&gt;Create a date, save it, retrieve it back and the DateTime.CompareTo() function says that they are not equal. All inner fields are equal except for the Ticks field. &lt;/p&gt;

&lt;p&gt;Not sure if it matters, but doing everything in SafeMode, and the date property is decorated with &lt;span class=&quot;error&quot;&gt;&amp;#91;BsonDateTimeOptions(Kind = DateTimeKind.Local)&amp;#93;&lt;/span&gt;.&lt;/p&gt;

&lt;p&gt;Steps to reproduce: &lt;br/&gt;
-------------------------------&lt;/p&gt;

&lt;p&gt;var myItem = new Item(...);&lt;/p&gt;

&lt;p&gt;var myDate = DateTime.Now;&lt;br/&gt;
myItem.date = myDate;&lt;/p&gt;

&lt;p&gt;// this assert is passes.&lt;br/&gt;
Assert.AreEqual(0, myDate.CompareTo(myItem.date));&lt;/p&gt;

&lt;p&gt;myCollection&amp;lt;Item&amp;gt;.Save(myItem, SafeMode.True);&lt;/p&gt;

&lt;p&gt;// query the db to get the same object that is myItem.&lt;br/&gt;
var savedAndRetrievedMyItem = myCollection.FindOneAs(...);&lt;/p&gt;

&lt;p&gt;// this assert fails. &lt;br/&gt;
Assert.AreEqual(0, myDate.CompareTo(savedAndRetrievedMyItem.date));&lt;/p&gt;</description>
                <environment>Win Server 2008. &lt;br/&gt;
.NET 3.5</environment>
        <key id="13800">CSHARP-114</key>
            <summary>DateTime data types are off by a few ticks</summary>
                <type id="1" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14703&amp;avatarType=issuetype">Bug</type>
                                            <priority id="4" iconUrl="https://jira.mongodb.org/images/icons/priorities/minor.svg">Minor - P4</priority>
                        <status id="6" iconUrl="https://jira.mongodb.org/images/icons/statuses/closed.png" description="The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.">Closed</status>
                    <statusCategory id="3" key="done" colorName="success"/>
                                    <resolution id="9">Done</resolution>
                                        <assignee username="robert@mongodb.com">Robert Stam</assignee>
                                    <reporter username="sym3tri">Ed Rooth</reporter>
                        <labels>
                    </labels>
                <created>Thu, 25 Nov 2010 08:24:33 +0000</created>
                <updated>Thu, 2 Apr 2015 18:27:52 +0000</updated>
                            <resolved>Wed, 1 Dec 2010 03:37:22 +0000</resolved>
                                                    <fixVersion>0.7</fixVersion>
                                                        <votes>0</votes>
                                    <watches>1</watches>
                                                                                                                <comments>
                            <comment id="20868" author="rstam" created="Wed, 1 Dec 2010 03:37:22 +0000"  >&lt;p&gt;Closed.&lt;/p&gt;</comment>
                            <comment id="20718" author="sym3tri" created="Fri, 26 Nov 2010 01:55:17 +0000"  >&lt;p&gt;Robert, thanks for clearing that up.&lt;/p&gt;

&lt;p&gt;For our purposes it&apos;s not really a big deal. I was just surprised when the CompareTo() function didn&apos;t work as expected. As long as this is well documented and understood by the users I think the current implementation is fine. &lt;/p&gt;

&lt;p&gt;However it is imaginable that this may cause issues for some scientific or financial applications.&lt;br/&gt;
Either way, it&apos;s still low priority in my opinion. &lt;/p&gt;</comment>
                            <comment id="20706" author="rstam" created="Thu, 25 Nov 2010 15:06:30 +0000"  >&lt;p&gt;.NET&apos;s DateTime values have a resolution of 100 nanoseconds per tick, but the BSON representation for a DateTime has a resolution of 1 millisecond. So when a .NET DateTime is stored in BSON some of the low order bits are lost.&lt;/p&gt;

&lt;p&gt;Do you think we need a way to store .NET DateTime&apos;s without loss of precision? Some possible alternatives are:&lt;/p&gt;

&lt;p&gt;1. Add an option to store a .NET DateTime as a BSON Int64 and store the Ticks&lt;br/&gt;
2. Add an option to store a .NET DateTime as a BSON document like:&lt;/p&gt;

{ &apos;DateTime&apos;: bsonDateTime, &apos;LowOrderTicks&apos; : 123 }

&lt;p&gt;Not sure this is worth addressing. SQL Server has a similar issue where its internal representation of a DateTime is not quite as precise as .NET&apos;s, and I think most people just accept that.&lt;/p&gt;

&lt;p&gt;Will probably end up closing this ticket as works as designed, but will leave it open a bit longer in hopes of more comments.&lt;/p&gt;</comment>
                            <comment id="20704" author="rstam" created="Thu, 25 Nov 2010 14:56:23 +0000"  >&lt;p&gt;Changed component to Driver.&lt;/p&gt;</comment>
                    </comments>
                    <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_15850" key="com.atlassian.jira.plugins.jira-development-integration-plugin:devsummary">
                        <customfieldname>Development</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|hrh9lz:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10558" key="com.pyxis.greenhopper.jira:gh-global-rank">
                        <customfieldname>Rank (Obsolete)</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>14356</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            </customfields>
    </item>
</channel>
</rss>