-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Closed
Labels
area-System.IOenhancementProduct code improvement that does NOT require public API changes/additionsProduct code improvement that does NOT require public API changes/additions
Milestone
Description
Steps to reproduce:
- Create a new console app
- Edit Program.cs to print it's last write time out:
using System;
using System.IO;
namespace ts_test
{
class Program
{
static void Main(string[] args)
{
var file = Path.Combine(Directory.GetCurrentDirectory(), "Program.cs");
var t = File.GetLastWriteTimeUtc(file);
Console.WriteLine(t.ToString("o"));
}
}
}On my Windows machine, here's the output:
2017-12-22T04:59:47.5871375Z
On my Ubuntu VM, here's the output:
2017-12-22T05:18:38.0000000Z
Notice the missing precision after the seconds digits. The filesystem does seem to have a higher precision timestamp associated with the file:
>:~/src/ts-test$ ls --full-time Program.cs
-rw-rw-r-- 1 prkrishn prkrishn 320 2017-12-22 05:18:38.250041900 +0000 Program.cs
dotnet --info
.NET Command Line Tools (2.0.2)
Product Information:
Version: 2.0.2
Commit SHA-1 hash: a04b4bf512
Runtime Environment:
OS Name: ubuntu
OS Version: 16.04
OS Platform: Linux
RID: ubuntu.16.04-x64
Base Path: /usr/share/dotnet/sdk/2.0.2/
Microsoft .NET Core Shared Framework Host
Version : 2.0.0
Build : e8b8861ac7faf042c87a5c2f9f2d04c98b69f28d
Further background:
I noticed this when I was writing tests to cover incremental build scenarios in my MSBuild target. MSBuild uses file timestamps to determine if the inputs are consistent with the outputs. Consequently inputs modified within a second of creating the output would be treated as consistent resulting in MSBuild target executions from being skipped. I also some my tests fail on Travis OSX 10.12 but I don't have a machine handy to confirm if this was the cause.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
area-System.IOenhancementProduct code improvement that does NOT require public API changes/additionsProduct code improvement that does NOT require public API changes/additions