bugDotGNU Portable.NET - Bugs: bug #26199, incorrect result for...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #26199: incorrect result for System.TimeSpan.MinValue.ToString()

Submitter:  Thomas Uxiou <uxiou>
Submitted:  Thu 16 Apr 2009 11:34:39 AM UTC
   
 
Category:  None Severity:  3 - Normal
Item Group:  None Status:  Fixed
Privacy:  Public Assigned to:  None
Open/Closed:  Closed

Sat 18 Apr 2009 06:58:19 PM UTC, comment #1: 

Just commited your patch in CVS (hope i did it right, had some troubles to extract the patch from the text).

Thanks!

Radek Polak <radekp>
Group Member
Thu 16 Apr 2009 11:34:39 AM UTC, original submission:  

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)

Thomas Uxiou <uxiou>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by radekp (Posted a comment)
  • -email is unavailable- added by uxiou (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

     

    Follow 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2009-04-18 radekp StatusNone Fixed
        Open/ClosedOpen Closed

    Back to the top

    Powered by Savane 3.13-bb6a.
    Corresponding source code