[Mono.Posix] Fix time_t conversions.
Fixes: https://bugzilla.xamarin.com/show_bug.cgi?id=12686
Mono.Unix.UnixFileSystemInfo.LastWriteTime & co. were hilariously
wrong. Just...hilariously wrong.
$ ls -l bxc12686.exe
-rwxr-xr-x 1 jon staff 4096 Jun 14 15:43 bxc12686.exe
$ csharp -r:Mono.Posix
csharp> new Mono.Unix.UnixFileInfo("bxc12686.exe").LastWriteTime;
6/14/2013 7:43:12 PM
Note: I'm currently in EDT (US Eastern Daylight Time). LastWriteTime
is supposed to be in the local time; it's 4 hours off (which also
happens to be the EDT UTF offset: -4:00).
The fundamental problem was that NativeConvert.FromTimeT() was written
for pre-.NET 2.0 environments, which precluded use (or knowledge of!)
DateTimeKind. Now that .NET 1.1 is no longer supported, and 2.0 is on
the its deathbead (bring on 4.5!), we can be smarter and let DateTime
sanely handle the conversion logic for us.
After the fix:
$ csharp -r:Mono.Posix
csharp> new Mono.Unix.UnixFileInfo("bxc12686.exe").LastWriteTime;
6/14/2013 3:43:12 PM