Author: atsushi
Date: 2007-11-01 08:08:42 -0500 (Thu, 01 Nov 2007)
New Revision: 88641

Modified:
   trunk/mcs/class/corlib/System/ChangeLog
   trunk/mcs/class/corlib/System/DateTime.cs
   trunk/mcs/class/corlib/Test/System/ChangeLog
   trunk/mcs/class/corlib/Test/System/DateTimeTest.cs
Log:
2007-11-01  Atsushi Enomoto  <[EMAIL PROTECTED]>

        * DateTime.cs : ParseExact() should ignore 'K' when there is no
          character is left.

        * DateTimeTest.cs : fixed test for bug #338064 - milliseconds are not
          fully stored and caused mismatch. Format string was wrong.
          Added test for local time parsing. 'K' should not cause missing
          data (it could be empty).



Modified: trunk/mcs/class/corlib/System/ChangeLog
===================================================================
--- trunk/mcs/class/corlib/System/ChangeLog     2007-11-01 13:04:35 UTC (rev 
88640)
+++ trunk/mcs/class/corlib/System/ChangeLog     2007-11-01 13:08:42 UTC (rev 
88641)
@@ -1,5 +1,10 @@
 2007-11-01  Atsushi Enomoto  <[EMAIL PROTECTED]>
 
+       * DateTime.cs : ParseExact() should ignore 'K' when there is no
+         character is left.
+
+2007-11-01  Atsushi Enomoto  <[EMAIL PROTECTED]>
+
        * DateTime.cs : in roundtrip mode, 'Z' should turn the tick value to
          utc time and should not result in different ticks.
          Fixed bug #338064.

Modified: trunk/mcs/class/corlib/System/DateTime.cs
===================================================================
--- trunk/mcs/class/corlib/System/DateTime.cs   2007-11-01 13:04:35 UTC (rev 
88640)
+++ trunk/mcs/class/corlib/System/DateTime.cs   2007-11-01 13:08:42 UTC (rev 
88641)
@@ -1640,6 +1640,10 @@
                                num = 0;
                        }
 
+#if NET_2_0
+                       while (pos < len && chars [pos] == 'K') // 'K' can be 
mapped to nothing
+                               pos++;
+#endif
                        if (pos < len)
                                return false;
 

Modified: trunk/mcs/class/corlib/Test/System/ChangeLog
===================================================================
--- trunk/mcs/class/corlib/Test/System/ChangeLog        2007-11-01 13:04:35 UTC 
(rev 88640)
+++ trunk/mcs/class/corlib/Test/System/ChangeLog        2007-11-01 13:08:42 UTC 
(rev 88641)
@@ -1,5 +1,12 @@
 2007-11-01  Atsushi Enomoto  <[EMAIL PROTECTED]>
 
+       * DateTimeTest.cs : fixed test for bug #338064 - milliseconds are not
+         fully stored and caused mismatch. Format string was wrong.
+         Added test for local time parsing. 'K' should not cause missing
+         data (it could be empty).
+
+2007-11-01  Atsushi Enomoto  <[EMAIL PROTECTED]>
+
        * DateTimeTest.cs : fixed bug #338064.
 
 2007-10-27  Zoltan Varga  <[EMAIL PROTECTED]>

Modified: trunk/mcs/class/corlib/Test/System/DateTimeTest.cs
===================================================================
--- trunk/mcs/class/corlib/Test/System/DateTimeTest.cs  2007-11-01 13:04:35 UTC 
(rev 88640)
+++ trunk/mcs/class/corlib/Test/System/DateTimeTest.cs  2007-11-01 13:08:42 UTC 
(rev 88641)
@@ -2120,13 +2120,21 @@
                public void RundtripKindPattern ()
                {
                        // only 2.0 supports 'K'
-                       string format = "yyyy-MM-ddTHH:mm:ss.FFFK";
+                       string format = "yyyy-MM-dd'T'HH:mm:ss.fffK";
                        CultureInfo ci = CultureInfo.CurrentCulture;
-                       DateTime dt = DateTime.UtcNow;
-                       string s = dt.ToString 
(format);//"2007-11-01T10:03:48.39Z";
+                       DateTime dt = DateTime.SpecifyKind (new DateTime (2007, 
11, 1, 2, 30, 45), DateTimeKind.Utc);
+                       string s = dt.ToString (format);
                        DateTime d1 = DateTime.ParseExact (s, format, ci);
                        Assert.AreEqual (dt.Ticks, d1.Ticks, "#1");
                        Assert.AreEqual (DateTimeKind.Utc, d1.Kind, "#2");
+
+                       format = "yyyy-MM-dd'T'HH:mm:ssK";
+                       ci = CultureInfo.CurrentCulture;
+                       dt = new DateTime (2007, 11, 1, 2, 30, 45);
+                       s = dt.ToString (format);
+                       d1 = DateTime.ParseExact (s, format, ci);
+                       Assert.AreEqual (dt.Ticks, d1.Ticks, "#3");
+                       Assert.AreEqual (DateTimeKind.Local, d1.Kind, "#4");
                }
 #endif
        }

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to