private static bool DaylightSavingsTime(double localTime) {
if (!useDST)
return false;
double t = (localTime + msTo1970) * ticksPerMillisecond;
if ((double)Int64.MinValue <= t && t <= (double)Int64.MaxValue)
try {
DateTime dt = new DateTime((long)t);
return System.TimeZone.CurrentTimeZone.IsDaylightSavingTime(dt);
}catch (System.ArgumentOutOfRangeException) { }
int month = MonthFromTime(localTime);
if (month < 3 || month > 9) return false;
if (month > 3 && month < 9) return true;
int date = DateFromTime(localTime);
if (month == 3) {
if (date > 7) return true;
int weekDay = WeekDay(localTime);
if (weekDay > 0)
return date > weekDay;
return HourFromTime(localTime) > 1;
} else {
if (date < 25) return true;
int weekDay = WeekDay(localTime);
if (weekDay > 0)
return date - weekDay < 25;
return HourFromTime(localTime) < 1;
}
}