[Mono-bugs] [Bug 71213][Wis] New - System.IO.File.SetCreationTime does not save dates on files correctly
bugzilla-daemon@bugzilla.ximian.com
bugzilla-daemon@bugzilla.ximian.com
Wed, 12 Jan 2005 13:59:57 -0500 (EST)
Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.
Changed by cgaisford@novell.com.
http://bugzilla.ximian.com/show_bug.cgi?id=71213
--- shadow/71213 2005-01-12 13:59:57.000000000 -0500
+++ shadow/71213.tmp.15807 2005-01-12 13:59:57.000000000 -0500
@@ -0,0 +1,78 @@
+Bug#: 71213
+Product: Mono: Class Libraries
+Version: 1.1
+OS:
+OS Details: OS X 10.3.7
+Status: NEW
+Resolution:
+Severity:
+Priority: Wishlist
+Component: System
+AssignedTo: mono-bugs@ximian.com
+ReportedBy: cgaisford@novell.com
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+Summary: System.IO.File.SetCreationTime does not save dates on files correctly
+
+It appears System.IO.File.SetCreationTime, SetLastWriteTime, and
+SetLastAccessTime all do not set the dates correctly on files. I have
+provided a simple app that reads a files time, sets the time forward a few
+seconds, writes it back to the file and re-reads it. This appears to be a
+byte translation problem between big and little endian.
+
+Here is the sample code:
+
+using System;
+
+
+public class tester
+{
+ public static void writeTime(string type, System.DateTime dt)
+ {
+ Console.WriteLine("{0} Date: {1}/{2}/{3} Time: {4}:{5}:{6}:{7}",
+type, dt.Month, dt.Day, dt.Year, dt.Hour, dt.Minute, dt.Second,
+dt.Millisecond);
+ }
+
+ public static void Main (string[] args)
+ {
+ Console.WriteLine("Date test for: {0}", args[0]);
+
+ System.DateTime cdt = System.IO.File.GetCreationTime(args[0]);
+ System.DateTime wdt = System.IO.File.GetLastWriteTime(args[0]);
+ System.DateTime adt = System.IO.File.GetLastAccessTime(args[0]);
+
+ writeTime("Creation: ", cdt);
+ writeTime("Write : ", wdt);
+ writeTime("Access : ", adt);
+
+ cdt = cdt.AddSeconds(10);
+ cdt = cdt.AddMilliseconds(1);
+
+ wdt = wdt.AddSeconds(20);
+ wdt = wdt.AddMilliseconds(1);
+
+ adt = adt.AddSeconds(30);
+ adt = adt.AddMilliseconds(1);
+
+ Console.WriteLine("");
+ writeTime("Creation: ", cdt);
+ writeTime("Write : ", wdt);
+ writeTime("Access : ", adt);
+
+ System.IO.File.SetCreationTime(args[0], cdt);
+ System.IO.File.SetLastWriteTime(args[0], wdt);
+ System.IO.File.SetLastAccessTime(args[0], adt);
+
+ cdt = System.IO.File.GetCreationTime(args[0]);
+ wdt = System.IO.File.GetLastWriteTime(args[0]);
+ adt = System.IO.File.GetLastAccessTime(args[0]);
+
+ Console.WriteLine("");
+ writeTime("Creation: ", cdt);
+ writeTime("Write : ", wdt);
+ writeTime("Access : ", adt);
+ }
+}