dotgnu-pnet
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Dotgnu-pnet] [bug #26199] incorrect result for System.TimeSpan.MinValue


From: Thomas Uxiou
Subject: [Dotgnu-pnet] [bug #26199] incorrect result for System.TimeSpan.MinValue.ToString()
Date: Thu, 16 Apr 2009 11:34:41 +0000
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en; rv:1.9.0.8) Gecko/20080528 Epiphany/2.22 Firefox/3.0

URL:
  <http://savannah.gnu.org/bugs/?26199>

                 Summary: incorrect result for
System.TimeSpan.MinValue.ToString()
                 Project: DotGNU Portable.NET
            Submitted by: uxiou
            Submitted on: Thu Apr 16 11:34:39 2009
                Category: None
                Severity: 3 - Normal
              Item Group: None
                  Status: None
                 Privacy: Public
             Assigned to: None
             Open/Closed: Open
         Discussion Lock: Any

    _______________________________________________________

Details:

Console.WriteLine("{0}", System.TimeSpan.MinValue.ToString());

output:   -10675199.0.:,(:0+.,))+(0(
expected: -10675199.02:48:05.4775808

patch:
# --- runtime/System/TimeSpan.cs        2009-04-16 11:19:09.000000000 +0200
# +++ runtime/System/TimeSpan.cs.fixed  2009-04-16 11:36:21.000000000 +0200
# @@ -108,20 +108,28 @@
#       // Formatting.
#       public override String ToString()
#                       {
# -                             int days = Days;
# -                             int hours = Hours;
# -                             int minutes = Minutes;
# -                             int seconds = Seconds;
# +                             int days = (int) Math.Abs(Days);
# +                             int hours = (int) Math.Abs(Hours);
# +                             int minutes = (int) Math.Abs(Minutes);
# +                             int seconds = (int) Math.Abs(Seconds);
#                               int fractional = unchecked((int)(value_ % 
TicksPerSecond));
# +                             fractional = (int) Math.Abs(fractional);
# +
#                               String result;
# -                             if(days != 0)
# +                             if(value_ < 0)
#                               {
# -                                     result = days.ToString() + ".";
# +                                     result = "-";
#                               }
#                               else
#                               {
#                                       result = String.Empty;
#                               }
# +
# +                             if(days != 0)
# +                             {
# +                                     result += days.ToString() + ".";
# +                             }
# +                             
#                               result = result + TwoDigits(hours) + ":" +
#                                                TwoDigits(minutes) + ":" + 
TwoDigits(seconds);
#                               if(fractional != 0)




    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?26199>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/





reply via email to

[Prev in Thread] Current Thread [Next in Thread]