dotgnu-pnet-commits
[Top][All Lists]
Advanced

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

[dotgnu-pnet-commits] pnetlib ChangeLog runtime/System/TimeSpan.cs


From: Radek Polak
Subject: [dotgnu-pnet-commits] pnetlib ChangeLog runtime/System/TimeSpan.cs
Date: Sat, 18 Apr 2009 18:53:22 +0000

CVSROOT:        /sources/dotgnu-pnet
Module name:    pnetlib
Changes by:     Radek Polak <radekp>    09/04/18 18:53:21

Modified files:
        .              : ChangeLog 
        runtime/System : TimeSpan.cs 

Log message:
        fix timespan min value tostring - bug #26199

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/pnetlib/ChangeLog?cvsroot=dotgnu-pnet&r1=1.2579&r2=1.2580
http://cvs.savannah.gnu.org/viewcvs/pnetlib/runtime/System/TimeSpan.cs?cvsroot=dotgnu-pnet&r1=1.11&r2=1.12

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/dotgnu-pnet/pnetlib/ChangeLog,v
retrieving revision 1.2579
retrieving revision 1.2580
diff -u -b -r1.2579 -r1.2580
--- ChangeLog   18 Apr 2009 10:25:03 -0000      1.2579
+++ ChangeLog   18 Apr 2009 18:53:21 -0000      1.2580
@@ -1,3 +1,8 @@
+2009-04-18  Thomas Uxiou  <address@hidden>
+
+       * runtime/System/TimeSpan.cs: Fix incorrect result for
+       System.TimeSpan.MinValue.ToString() (bug #26199).
+
 2009-04-18  Klaus Treichel  <address@hidden>
 
        * runtime/String.cs: Check for negative count and throw an

Index: runtime/System/TimeSpan.cs
===================================================================
RCS file: /sources/dotgnu-pnet/pnetlib/runtime/System/TimeSpan.cs,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -b -r1.11 -r1.12
--- runtime/System/TimeSpan.cs  15 Feb 2009 16:09:06 -0000      1.11
+++ runtime/System/TimeSpan.cs  18 Apr 2009 18:53:21 -0000      1.12
@@ -138,20 +138,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 via email to

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