Bug 39995 - IsDaylightSavingTime value is incorrect
Summary: IsDaylightSavingTime value is incorrect
Status: RESOLVED INVALID
Alias: None
Product: Class Libraries
Classification: Mono
Component: System ()
Version: master
Hardware: All Linux
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2016-03-30 15:47 UTC by Neale Ferguson
Modified: 2016-03-30 22:35 UTC (History)
1 user (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 INVALID

Description Neale Ferguson 2016-03-30 15:47:04 UTC
Building and running the following program:

using System;
using System.Reflection;
using System.Diagnostics;

namespace fail100
{
	class MainClass
	{
		public static void Main (string[] args)
		{
			FieldInfo fi = typeof(TimeZone).GetField("currentTimeZone", BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.Instance);
			fi.SetValue(null, null);

			DateTime st = new DateTime(2016, 3, 27, 0, 0, 0, DateTimeKind.Utc);
			DateTime localST = st.ToLocalTime();
			Console.WriteLine("UTC {0} --> GMT {1} isDST={2}", st.ToString(), localST.ToString(), localST.IsDaylightSavingTime());

			DateTime dst = new DateTime(2016, 3, 27, 2, 0, 0, DateTimeKind.Utc);
			DateTime localDST = dst.ToLocalTime();
			Console.WriteLine("UTC {0} --> GMT {1} isDST={2}", dst.ToString(), localDST.ToString(), localDST.IsDaylightSavingTime());

			dst = new DateTime(2016, 11, 30, 0, 0, 0, DateTimeKind.Utc);
			localDST = dst.ToLocalTime();
			Console.WriteLine("UTC {0} --> GMT {1} isDST={2}", dst.ToString(), localDST.ToString(), localDST.IsDaylightSavingTime());

			st = new DateTime(2016, 10, 30, 2, 0, 0, DateTimeKind.Utc);
			localST = st.ToLocalTime();
			Console.WriteLine("UTC {0} --> GMT {1} isDST={2}", st.ToString(), localST.ToString(), localST.IsDaylightSavingTime());
		}
	}
} 

On .NET yields:

C:\WORK>set TZ=UTC00:00UTC-1:00,M03.05.00/01.00,M10.05.00/02.00

C:\WORK>44525
TZ: System.TimeZone currentTimeZone
UTC 3/27/2016 12:00:00 AM --> GMT 3/26/2016 8:00:00 PM isDST=True
UTC 3/27/2016 2:00:00 AM --> GMT 3/26/2016 10:00:00 PM isDST=True
UTC 11/30/2016 12:00:00 AM --> GMT 11/29/2016 7:00:00 PM isDST=False
UTC 10/30/2016 2:00:00 AM --> GMT 10/29/2016 10:00:00 PM isDST=True

On Mono:

> TZ=EST00:00EDT-1:00,M03.05.00/01.00,M10.05.00/02.00 mono 44525.exe 
UTC 3/27/2016 12:00:00 AM --> GMT 3/27/2016 1:00:00 AM isDST=False
UTC 3/27/2016 2:00:00 AM --> GMT 3/27/2016 3:00:00 AM isDST=False
UTC 11/30/2016 12:00:00 AM --> GMT 11/30/2016 1:00:00 AM isDST=False
UTC 10/30/2016 2:00:00 AM --> GMT 10/30/2016 3:00:00 AM isDST=False
Comment 1 Neale Ferguson 2016-03-30 15:56:23 UTC
Correction - 

mono 3.10:

UTC 3/27/2016 12:00:00 AM --> GMT 3/27/2016 1:00:00 AM isDST=False
UTC 3/27/2016 2:00:00 AM --> GMT 3/27/2016 3:00:00 AM isDST=False
UTC 11/30/2016 12:00:00 AM --> GMT 11/30/2016 1:00:00 AM isDST=False
UTC 10/30/2016 2:00:00 AM --> GMT 10/30/2016 3:00:00 AM isDST=False

mono - trunk

UTC 3/27/2016 12:00:00 AM --> GMT 3/27/2016 12:00:00 AM isDST=False
UTC 3/27/2016 2:00:00 AM --> GMT 3/27/2016 2:00:00 AM isDST=False
UTC 11/30/2016 12:00:00 AM --> GMT 11/30/2016 12:00:00 AM isDST=False
UTC 10/30/2016 2:00:00 AM --> GMT 10/30/2016 2:00:00 AM isDST=False
Comment 2 Neale Ferguson 2016-03-30 22:34:45 UTC
Ignore. Problem is with a different component, the TZ is a furphy.