[Mono-bugs] [Bug 661787] New: Inconsitency of XmlConvert.ToDateTime() between Mono/MS.Net when parsing UTC dates

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Wed Dec 29 18:05:11 EST 2010



           Summary: Inconsitency of XmlConvert.ToDateTime() between
                    Mono/MS.Net when parsing UTC dates
    Classification: Mono
           Product: Mono: Class Libraries
           Version: SVN
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: Sys.XML
        AssignedTo: atsushi at ximian.com
        ReportedBy: pruiz at netway.org
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---
           Blocker: ---

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US)
AppleWebKit/534.7 (KHTML, like Gecko) Chrome/7.0.517.44 Safari/534.7

While debugging a serialization problem I found a Mono/MS.Net inconsistency
when calling XmlConvert.ToDateTime("2010-12-29T22:01:15.1619814",

This exact same call on MS.Net returns: "12/29/2010 22:01:15"
While on mono (windows and linux) returns: "12/29/2010 21:01:15"

My localtime it's UTC+1, but even running the code setting CurrentCulture to
InvariantCulture does not affect the results.

So it seems like mono's code takes into account LocalTime when
parsing/converting the date, while MS.Net simple returns a DateTime instance
with the exact date/time from the string, but with Kind == UTC.

Reproducible: Always

Steps to Reproduce:
1. gmcs /out:test.exe /target:exe test.cs 
2. ./text.exe
3. See output.
Actual Results:  
Date: 12/29/2010 21:01:15

Expected Results:  
Date: 12/29/2010 22:01:15

Here is an example output of running the sample code on MS.Net and Mono/win32:

$  /cygdrive/c/Windows/Microsoft.NET/Framework/v3.5/csc /out:ms.exe /target:exe
test.cs && ./ms.exe 
Microsoft (R) Visual C# 2008 Compiler version 3.5.30729.4926
for Microsoft (R) .NET Framework version 3.5
Copyright (C) Microsoft Corporation. All rights reserved.

Date: 12/29/2010 22:01:15

&& echo -en '\nNow with mono:\n' && /opt/mono/bin/gmcs /out:lnx.exe /target:exe
test.cs && /opt/mono/bin/mono lnx.exe

Date: 12/29/2010 21:01:15

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

More information about the mono-bugs mailing list