TimeProvider GetLocalNow enhancement (#90066)
authorWeihan Li <weihanli@outlook.com>
Sun, 6 Aug 2023 22:07:22 +0000 (06:07 +0800)
committerGitHub <noreply@github.com>
Sun, 6 Aug 2023 22:07:22 +0000 (15:07 -0700)
Co-authored-by: Tarek Mahmoud Sayed <tarekms@microsoft.com>
src/libraries/Common/src/System/TimeProvider.cs

index a6e2936..9eca00f 100644 (file)
@@ -57,6 +57,10 @@ namespace System
 #endif // SYSTEM_PRIVATE_CORELIB
             }
             TimeSpan offset = zoneInfo.GetUtcOffset(utcDateTime);
+            if (offset.Ticks is 0)
+            {
+                return utcDateTime;
+            }
 
             long localTicks = utcDateTime.Ticks + offset.Ticks;
             if ((ulong)localTicks > (ulong)s_maxDateTicks)