[Mono-bugs] [Bug 399389] New: DateTime.AddMilliseconds should round to nearest integer

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Wed Jun 11 14:57:26 EDT 2008


https://bugzilla.novell.com/show_bug.cgi?id=399389


           Summary: DateTime.AddMilliseconds should round to nearest integer
           Product: Mono: Class Libraries
           Version: SVN
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: CORLIB
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: gert.driesen at pandora.be
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---


Currently, our implementation of DateTime.AddMilliseconds does not round the
specified number of milliseconds to the nearest integer.

This actually matches the documentation (but not the implementation) of .NET
1.1, but MS fixed the documentation in .NET 2.0.

To reproduce, compile and run the following code:

using System;


class Program
{
        static void Main ()
        {
                DateTime date = new DateTime (2008, 12, 7);
                dt = dt.AddMilliseconds (8.888);
                Console.WriteLine (dt.Ticks);
                dt = dt.AddMilliseconds (-5.444);
                Console.WriteLine (dt.Ticks);
        }
}

Expected result:

633642048000090000
633642048000040000

Actual result:

633642048000088880
633642048000034440


-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.


More information about the mono-bugs mailing list