-
Notifications
You must be signed in to change notification settings - Fork 5.4k
NET6 - Wrong DateTime.ToString() formating when using monoVM and linux-arm #61598
Description
Description
DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff") - returns
2021-11-15 14:54:33.3378046 -when app is published with -p:UseMonoRuntime=true.
When using default runtime (without -p:UseMonoRuntime=true) it returns
2021-11-15 15:58:30.675
Reproduction Steps
I was testing minimum possible delay with following program:
using System.Diagnostics;
Stopwatch sw = new Stopwatch();
while(true)
{
sw.Restart();
Thread.Sleep(1);
sw.Stop();
Console.WriteLine($"{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff")} - Elapsed {sw.ElapsedMilliseconds}");
}
compiled with
dotnet publish -r linux-arm -p:PublishTrimmed=True -p:TrimMode=Link --self-contained true -c Release -f net6.0 -o bin\dotnet\mono -p:UseMonoRuntime=true for mono VM
and
dotnet publish -r linux-arm -p:PublishTrimmed=True -p:TrimMode=Link --self-contained true -c Release -f net6.0 -o bin\dotnet
for default runtime
Expected behavior
fff in DateTime.ToString() should return 1/1000ths of second
Actual behavior
fff in DateTime.ToString() return 1/10 000 000 of second
in screenshot - first with mono, then with dotnet default

Regression?
No response
Known Workarounds
No response
Configuration
No response
Other information
Tested on 32bit linux-arm on Yocto linux