Skip to content

Commit

Permalink
2003-02-28 Elan Feingold <efeingold@mn.rr.com>
Browse files Browse the repository at this point in the history
	* 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.

svn path=/trunk/mcs/; revision=12038
  • Loading branch information
Alan Tam committed Feb 27, 2003
1 parent ad4821f commit dc08121
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
8 changes: 8 additions & 0 deletions mcs/class/corlib/System/ChangeLog
@@ -1,3 +1,11 @@
2003-02-28 Elan Feingold <efeingold@mn.rr.com>

* 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.

2003-02-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>

* Attribute.cs:
Expand Down
11 changes: 9 additions & 2 deletions mcs/class/corlib/System/DateTime.cs
Expand Up @@ -486,6 +486,11 @@ public static DateTime Parse (string s, IFormatProvider fp)
public static DateTime Parse (string s, IFormatProvider fp, DateTimeStyles styles)
{
string[] formats = {
// 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:sszzz",
// Full date and time
"F", "G", "r", "s", "u", "U",
// Full date and time, but no seconds
Expand Down Expand Up @@ -987,11 +992,13 @@ public DateTime Subtract(TimeSpan ts)

public long ToFileTime()
{
if(ticks.Ticks < w32file_epoch) {
DateTime universalTime = ToUniversalTime();

if (universalTime.Ticks < w32file_epoch) {
throw new ArgumentOutOfRangeException("file time is not valid");
}

return(ticks.Ticks - w32file_epoch);
return(universalTime.Ticks - w32file_epoch);
}

public string ToLongDateString()
Expand Down

0 comments on commit dc08121

Please sign in to comment.