Class BclDateTimeZone
Inherited Members
Namespace: NodaTime.TimeZones
Assembly: NodaTime.dll
Syntax
public sealed class BclDateTimeZone : DateTimeZone, IZoneIntervalMapWithMinMax, IZoneIntervalMap
Remarks
Two instances of this class are deemed equal if and only if they refer to the exact same TimeZoneInfo object.
This implementation does not always give the same results as TimeZoneInfo
, in that it doesn't replicate
the bugs in the BCL interpretation of the data. These bugs are described in
a blog post, but we're
not expecting them to be fixed any time soon. Being bug-for-bug compatible would not only be tricky, but would be painful
if the BCL were ever to be fixed. As far as we are aware, there are only discrepancies around new year where the zone
changes from observing one rule to observing another.
As of version 3.0, a new "incompatible but doing the right thing" category of differences has been implemented, for time zones which have a transition at 24:00. The Windows time zone data represents this as a transition at 23:59:59.999, and that's faithfully represented by TimeZoneInfo (and BclDateTimeZone in version 2.x). As of 3.0, this is spotted and converted to a midnight-on-the-following-day transition.
Properties
DisplayName
Declaration
public string DisplayName { get; }
Property Value
Type | Description |
---|---|
String | The display name associated with the time zone, as provided by the Base Class Library. |
Remarks
Two instances of this class are deemed equal if and only if they refer to the exact same TimeZoneInfo object.
This implementation does not always give the same results as TimeZoneInfo
, in that it doesn't replicate
the bugs in the BCL interpretation of the data. These bugs are described in
a blog post, but we're
not expecting them to be fixed any time soon. Being bug-for-bug compatible would not only be tricky, but would be painful
if the BCL were ever to be fixed. As far as we are aware, there are only discrepancies around new year where the zone
changes from observing one rule to observing another.
As of version 3.0, a new "incompatible but doing the right thing" category of differences has been implemented, for time zones which have a transition at 24:00. The Windows time zone data represents this as a transition at 23:59:59.999, and that's faithfully represented by TimeZoneInfo (and BclDateTimeZone in version 2.x). As of 3.0, this is spotted and converted to a midnight-on-the-following-day transition.
OriginalZone
Declaration
public TimeZoneInfo OriginalZone { get; }
Property Value
Type | Description |
---|---|
TimeZoneInfo | The original TimeZoneInfo from which this was created. |
Remarks
Two instances of this class are deemed equal if and only if they refer to the exact same TimeZoneInfo object.
This implementation does not always give the same results as TimeZoneInfo
, in that it doesn't replicate
the bugs in the BCL interpretation of the data. These bugs are described in
a blog post, but we're
not expecting them to be fixed any time soon. Being bug-for-bug compatible would not only be tricky, but would be painful
if the BCL were ever to be fixed. As far as we are aware, there are only discrepancies around new year where the zone
changes from observing one rule to observing another.
As of version 3.0, a new "incompatible but doing the right thing" category of differences has been implemented, for time zones which have a transition at 24:00. The Windows time zone data represents this as a transition at 23:59:59.999, and that's faithfully represented by TimeZoneInfo (and BclDateTimeZone in version 2.x). As of 3.0, this is spotted and converted to a midnight-on-the-following-day transition.
Methods
ForSystemDefault()
Declaration
public static BclDateTimeZone ForSystemDefault()
Returns
Type | Description |
---|---|
BclDateTimeZone | A BclDateTimeZone wrapping the "local" (system) time zone as returned by Local. |
Remarks
This method is approximately equivalent to calling GetSystemDefault() with an implementation that wraps BclDateTimeZoneSource (e.g. Bcl), with the exception that it will succeed even if the current local time zone was not one of the set of system time zones captured when the source was created (which, while highly unlikely, might occur either because the local time zone is not a system time zone, or because the system time zones have themselves changed).
This method will retain a reference to the returned BclDateTimeZone
, and will attempt to return it if
called repeatedly (assuming that the local time zone has not changed) rather than creating a new instance,
though this behaviour is not guaranteed.
Exceptions
Type | Condition |
---|---|
InvalidOperationException | The system does not provide a time zone. |
FromTimeZoneInfo(TimeZoneInfo)
Declaration
public static BclDateTimeZone FromTimeZoneInfo(TimeZoneInfo bclZone)
Parameters
Type | Name | Description |
---|---|---|
TimeZoneInfo | bclZone | The original time zone to take information from. |
Returns
Type | Description |
---|---|
BclDateTimeZone | A BclDateTimeZone wrapping the given TimeZoneInfo . |
Remarks
Two instances of this class are deemed equal if and only if they refer to the exact same TimeZoneInfo object.
This implementation does not always give the same results as TimeZoneInfo
, in that it doesn't replicate
the bugs in the BCL interpretation of the data. These bugs are described in
a blog post, but we're
not expecting them to be fixed any time soon. Being bug-for-bug compatible would not only be tricky, but would be painful
if the BCL were ever to be fixed. As far as we are aware, there are only discrepancies around new year where the zone
changes from observing one rule to observing another.
As of version 3.0, a new "incompatible but doing the right thing" category of differences has been implemented, for time zones which have a transition at 24:00. The Windows time zone data represents this as a transition at 23:59:59.999, and that's faithfully represented by TimeZoneInfo (and BclDateTimeZone in version 2.x). As of 3.0, this is spotted and converted to a midnight-on-the-following-day transition.
GetZoneInterval(Instant)
Declaration
public override ZoneInterval GetZoneInterval(Instant instant)
Parameters
Type | Name | Description |
---|---|---|
Instant | instant | The Instant to query. |
Returns
Type | Description |
---|---|
ZoneInterval | The defined ZoneInterval. |