DateTime.WinRT.cs 1.2 KB

123456789101112131415161718192021222324252627
  1. // Licensed to the .NET Foundation under one or more agreements.
  2. // The .NET Foundation licenses this file to you under the MIT license.
  3. // See the LICENSE file in the project root for more information.
  4. using System.Runtime.CompilerServices;
  5. using System.Runtime.InteropServices;
  6. namespace System
  7. {
  8. public readonly partial struct DateTime
  9. {
  10. private static unsafe bool SystemSupportsLeapSeconds()
  11. {
  12. Interop.Kernel32.PROCESS_LEAP_SECOND_INFO info;
  13. // Store apps don't have access to an API that would let us find out whether leap seconds have been
  14. // disabled by policy: this implementation will produce slightly different results from what
  15. // we have for Win32. If GetProcessInformation succeeds, we have to act as if leap seconds existed.
  16. // They could still have been disabled by policy, but we have no way to check for that.
  17. return Interop.Kernel32.GetProcessInformation(
  18. Interop.Kernel32.GetCurrentProcess(),
  19. Interop.Kernel32.ProcessLeapSecondInfo,
  20. &info,
  21. sizeof(Interop.Kernel32.PROCESS_LEAP_SECOND_INFO)) != Interop.BOOL.FALSE;
  22. }
  23. }
  24. }