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)

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


Attachments

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 ***

Note You need to log in before you can comment on or make changes to this bug.