Bug 43804 - Output of DateTime.Now() differs on Mono for ambiguous time period
Summary: Output of DateTime.Now() differs on Mono for ambiguous time period
Status: RESOLVED DUPLICATE of bug 43805
Alias: None
Product: Class Libraries
Classification: Mono
Component: System (show other bugs)
Version: unspecified
Hardware: PC Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2016-08-27 00:21 UTC by Neale Ferguson
Modified: 2016-08-29 10:49 UTC (History)
2 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED DUPLICATE of bug 43805

Description Neale Ferguson 2016-08-27 00:21:38 UTC
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@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.

In https://msdn.microsoft.com/en-us/library/bb384269(v=vs.110).aspx it says 'Make an assumption about how the time maps to UTC. For example, you can assume that an ambiguous time is always expressed in the time zone's standard time.’ However, it appears .NET does not take this advice and will return the daylight saving time for that ambiguous hour.

I suggest that Mono mimic .NET.
Comment 1 Marek Safar 2016-08-29 10:49:18 UTC

*** This bug has been marked as a duplicate of bug 43805 ***