| | | 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 | | |
| | | 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 | | |
| | 0 | 13 | | public DaylightTime(DateTime start, DateTime end, TimeSpan delta) |
| | | 14 | | { |
| | 0 | 15 | | _start = start; |
| | 0 | 16 | | _end = end; |
| | 0 | 17 | | _delta = delta; |
| | 0 | 18 | | } |
| | | 19 | | |
| | | 20 | | // The start date of a daylight saving period. |
| | 0 | 21 | | public DateTime Start => _start; |
| | | 22 | | |
| | | 23 | | // The end date of a daylight saving period. |
| | 0 | 24 | | public DateTime End => _end; |
| | | 25 | | |
| | | 26 | | // Delta to stardard offset in ticks. |
| | 0 | 27 | | public TimeSpan Delta => _delta; |
| | | 28 | | } |
| | | 29 | | |
| | | 30 | | // Value type version of DaylightTime |
| | | 31 | | internal readonly struct DaylightTimeStruct |
| | | 32 | | { |
| | | 33 | | public DaylightTimeStruct(DateTime start, DateTime end, TimeSpan delta) |
| | | 34 | | { |
| | | 35 | | Start = start; |
| | | 36 | | End = end; |
| | | 37 | | Delta = delta; |
| | | 38 | | } |
| | | 39 | | |
| | | 40 | | public readonly DateTime Start; |
| | | 41 | | public readonly DateTime End; |
| | | 42 | | public readonly TimeSpan Delta; |
| | | 43 | | } |
| | | 44 | | } |
| | | 45 | | |