[Mono-dev] DateTime.Now incompatibility
Neale Ferguson
neale at sinenomine.net
Thu Aug 4 18:07:47 UTC 2016
If I run the following program:
using System;
public class Example
{
public static void Main()
{
Console.WriteLine(DateTime.Now);
}
}
Using the Great Britain timezone UTC and if I set the system date and
time to a couple of hours before the transition (midnight on the 30th UTC)
from daylight saving time back to standard time (2016-10-30 02:00:00):
[neale at lneale3 - mono] sudo date --utc 103000002016.00
Sun Oct 30 00:00:00 UTC 2016
And run the program. I would expect that my time would be UTC (1am) -
which it is when I run it on Windows .NET. However, it comes out as
midnight as it determines that we are in the ambiguous hour and simply
applies the base offset.
I am trying to determine what the logic should be for it to disambiguate
this time and apply the correct offset and give me the same value as
Windows.
I did look at just plugging in the Reference Source version of the class
but there is a lot of platform specific code in the Mono version so it is
not a simple task.
Neale
More information about the Mono-devel-list
mailing list