Bug 23376 - TimeSpan returns incorrect result
Summary: TimeSpan returns incorrect result
Status: RESOLVED FIXED
Alias: None
Product: Class Libraries
Classification: Mono
Component: mscorlib ()
Version: unspecified
Hardware: PC Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Marek Safar
URL:
Depends on:
Blocks:
 
Reported: 2014-09-25 12:02 UTC by Cody Beyer (MSFT)
Modified: 2014-11-27 08:44 UTC (History)
4 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FIXED

Description Cody Beyer (MSFT) 2014-09-25 12:02:51 UTC
Running the following code:

using System;
					
public class Program
{
	public static void Main()
	{
		Console.WriteLine("Hello World");
		TimeSpan ts = TimeSpan.FromSeconds(0.05); Console.WriteLine(ts);
		string format =  "s\\.f";
        Console.WriteLine(ts.ToString(format));
	}
}

Produces the following as output
Hello World
00:00:00.0500000
0.5

When it should produce:

Hello World
00:00:00.0500000
0.0

Due to 		

string format =  "s\\.f";

Requesting just one figure
Comment 2 Marek Safar 2014-09-27 10:41:57 UTC
Fixed in master
Comment 3 narayanp 2014-11-27 08:44:43 UTC
I have checked this issue and now I am getting the output as expected:

Hello World
00:00:00.0500000
0.0

I run the code mentioned in bug description and now it producing correct output.

Screencast: http://screencast.com/t/yh6cTGB16L

Hence, I am closing this issue.

Environment info:
=== Xamarin Studio ===

Version 5.7 (build 596)
Installation UUID: 561c7a69-0a91-4bae-ad7c-f0c79d594337
Runtime:
	Mono 3.12.0 ((detached/b75fa2b)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 312000046

=== Apple Developer Tools ===

Xcode 5.1.1 (5085)
Build 5B1008

=== Xamarin.iOS ===

Version: 8.6.0.5 (Trial Edition)
Hash: 880cc21
Branch: 
Build date: 2014-11-25 12:12:17-0500

=== Xamarin.Android ===

Version: 5.0.0.0 (Trial Edition)
Android SDK: /Users/tajinder/Desktop/android-sdk-macosx
	Supported Android versions:
		2.3    (API level 10)
		4.0.3  (API level 15)
		4.1    (API level 16)
		4.2    (API level 17)
		4.3    (API level 18)
		4.4    (API level 19)
		4.4.87 (API level 20)
		5.0    (API level 21)
Java SDK: /usr
java version "1.7.0_67"
Java(TM) SE Runtime Environment (build 1.7.0_67-b01)
Java HotSpot(TM) 64-Bit Server VM (build 24.65-b04, mixed mode)

=== Xamarin.Mac ===

Version: 1.11.1.201 (Indie Edition)

=== Build Information ===

Release ID: 507000596
Git revision: d996e9ba6874a0d64241e43e5e6b06322ce29c84
Build date: 2014-11-25 17:17:54-05
Xamarin addins: 8ca19707b41536a391f53364ee4ff9272711feb0

=== Operating System ===

Mac OS X 10.8.4
Darwin Tajinders-iMac.local 12.4.2 Darwin Kernel Version 12.4.2
    Mon Jun 17 18:00:12 PDT 2013
    root:xnu-2050.45.8~1/RELEASE_X86_64 x86_64