Issue Title
DateTime.Now returns incorrect time on windows computer when time zone has changed
General
Details
I was running a windows service created in C# when I noticed my computer was set to the wrong time zone. I switched it to the correct timezone and waited for my service to do something. It did not. I restarted the service and it worked correctly. I created a test app in C# and noticed that If I change my timezone, DateTime.Now does not use the updated time. I then created a test app in .NET Core to see if it had the same behavior, and it does.
.NET Core version
.NET Core 2.1
Operating System version
Windows 10 Pro - 1903 (18362.207)
Test Code
using System;
namespace DateTimeNowTest
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine(DateTime.Now);
Console.ReadLine();
//Before pressing enter, change time zone
Console.WriteLine(DateTime.Now);
}
}
}
Issue Title
DateTime.Now returns incorrect time on windows computer when time zone has changed
General
Details
I was running a windows service created in C# when I noticed my computer was set to the wrong time zone. I switched it to the correct timezone and waited for my service to do something. It did not. I restarted the service and it worked correctly. I created a test app in C# and noticed that If I change my timezone, DateTime.Now does not use the updated time. I then created a test app in .NET Core to see if it had the same behavior, and it does.
.NET Core version
.NET Core 2.1
Operating System version
Windows 10 Pro - 1903 (18362.207)
Test Code