I\'ve been working with the DateTime
and TimeZoneInfo
classes and I ran into an interesting result with the following code:
var dstStar
I did a little bit of reflecting and I believe the inconsistency stems from how System.TimeZoneInfo+CachedData.GetCorrespondingKind(TimeZoneInfo timeZone)
returns DateTimeKind.Local
only in the case where timeZone == this.m_localTimeZone
(ie, when the argument was the same instance as the TimeZoneInfo.Local
property is based on).
In the case where you pass this other TimeZoneInfo
instance you got from TimeZoneInfo.FindSystemTimeZoneById
I expect that it returns DateTimeKind.Unspecified
.
This will (probably among other things) affect System.TimeZoneInfo.IsDaylightSavingTime(DateTime dateTime)
where, in the case where dateTime.Kind
is local, it does a conversion between essentially TimeZoneInfo.Local
and your TimeZoneInfo
instance and bases the conversion on what GetCorrespondingKind
says for the source and target timezones (the conversion returns the original datetime in the case where source and target are both local).