We're upgrading our app, including tests, from .NET Framework to .NET 6.
I know there are globalization changes in .NET 6 (ICU instead of NLS) as well as floating point formatting becoming IEEE compliant.
But the tests have also found some small differences in DateTime
arithmetic:
BitConverter.GetBytes(TimeSpan.FromTicks(3124137599999990000).TotalDays)
returns (marginally) different answers between .NET 4.7.2 and .NET 6.0.
Any idea what causes this change? I prefer to understand the differences before updating the tests.
Sorry: the values are:
GetBytes(TotalDays)
Net4: 231,255,255,255,77,150,75,65
Net6: 230,255,255,255,77,150,75,65
TotalDays.ToString("G17")
Net4: 3615899.9999999879
Net6: 3615899.9999999884
It's the TotalDays
calculation that is different (I used GetBytes
as an alternative to formatting)