DaylightTime.cs 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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. namespace System.Globalization
  5. {
  6. // This class represents a starting/ending time for a period of daylight saving time.
  7. public class DaylightTime
  8. {
  9. private readonly DateTime _start;
  10. private readonly DateTime _end;
  11. private readonly TimeSpan _delta;
  12. public DaylightTime(DateTime start, DateTime end, TimeSpan delta)
  13. {
  14. _start = start;
  15. _end = end;
  16. _delta = delta;
  17. }
  18. // The start date of a daylight saving period.
  19. public DateTime Start => _start;
  20. // The end date of a daylight saving period.
  21. public DateTime End => _end;
  22. // Delta to stardard offset in ticks.
  23. public TimeSpan Delta => _delta;
  24. }
  25. // Value type version of DaylightTime
  26. internal readonly struct DaylightTimeStruct
  27. {
  28. public DaylightTimeStruct(DateTime start, DateTime end, TimeSpan delta)
  29. {
  30. Start = start;
  31. End = end;
  32. Delta = delta;
  33. }
  34. public readonly DateTime Start;
  35. public readonly DateTime End;
  36. public readonly TimeSpan Delta;
  37. }
  38. }