[Mono-list] Patch for DataTime.cs

Elan Feingold efeingold@mn.rr.com
Thu, 27 Feb 2003 12:36:34 -0600

This is a multi-part message in MIME format.

Content-Type: text/plain;
Content-Transfer-Encoding: quoted-printable

* DateTime.cs: FileTime is expressed in Universal time, and as such must
be converted
before subtracting the magic offset.

* DateTime.cs: Strings in the format "2003-02-27T10:05:03-11:00" (note
the timezone
at the end) *must* be parsed by DateTime.Parse() for compatibility with
Microsoft. This came up in my work with XML [de]serialization, which
I'll send a patch for shortly

* DateTimeFormatInfo.cs: The date time format patterns didn't match MS

> Can you add your tests to mcs/class/corlib/Test/....?

As soon as I can figure out how to run the test system, I'd be happy to.
Can you point a newbie like me at a web page or something to look at?

> What does patch 3 do? I mean, can you please write a few lines =E0 la
> ChangeLog style?

Is the above what you're looking for? If not, let me know.


Content-Type: application/octet-stream;
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;

Index: class/corlib/System/DateTime.cs=0A=
RCS file: /mono/mcs/class/corlib/System/DateTime.cs,v=0A=
retrieving revision 1.30=0A=
diff -b -u -r1.30 DateTime.cs=0A=
--- class/corlib/System/DateTime.cs	28 Jan 2003 15:28:13 -0000	1.30=0A=
+++ class/corlib/System/DateTime.cs	27 Feb 2003 18:18:31 -0000=0A=
@@ -486,6 +486,11 @@=0A=
 		public static DateTime Parse (string s, IFormatProvider fp, =
DateTimeStyles styles)
 			string[] formats =3D {
+                // For compatibility with MS's CLR, this format (which
+                // doesn't have a one-letter equivalent) is parsed
+                // too. It's important because it's used in XML
+                // serialization.
+                "yyyy-MM-ddTHH:mm:sszzzzzz",
 				// Full date and time
 				"F", "G", "r", "s", "u", "U",
 				// Full date and time, but no seconds
@@ -991,7 +996,7 @@=0A=
 				throw new ArgumentOutOfRangeException("file time is not valid");
-			return(ticks.Ticks - w32file_epoch);
+			return(ToUniversalTime().Ticks - w32file_epoch);
 		public string ToLongDateString()
Index: class/corlib/System.Globalization/DateTimeFormatInfo.cs=0A=
RCS file: =
retrieving revision 1.4=0A=
diff -b -u -r1.4 DateTimeFormatInfo.cs=0A=
--- class/corlib/System.Globalization/DateTimeFormatInfo.cs	12 Jun 2002 =
11:02:53 -0000	1.4=0A=
+++ class/corlib/System.Globalization/DateTimeFormatInfo.cs	27 Feb 2003 =
18:18:31 -0000=0A=
@@ -92,13 +92,13 @@=0A=
 			_TimeSeparator =3D ":";=0A=
-			_ShortDatePattern =3D "MM/dd/yyyy";=0A=
+			_ShortDatePattern =3D "%M/dd/yyyy";
 			_LongDatePattern =3D "dddd, dd MMMM yyyy";=0A=
-			_ShortTimePattern =3D "HH:mm";=0A=
+			_ShortTimePattern =3D "%h:mm tt";
-			_LongTimePattern =3D "HH:mm:ss";=0A=
+			_LongTimePattern =3D "%h:mm:ss tt";
 			_MonthDayPattern =3D "MMMM dd";=0A=