Closed Minq-Park closed 2 months ago
I suspect what happened here is a daylight savings time error. I don't know for sure, but it's possible TimeZoneInfo.ConvertTimeFromUtc is using modern DST rules, but in a year (1917) before WW2 when the USA started using DST for the first time.
As you correctly pointed out, the TimeZoneInfo.ConvertTimeFromUtc method seems to be applying the current Daylight Saving Time even to past time zones. I've confirmed that implementing standard time conversion and Daylight Saving Time separately resolves this issue. Thank you for your help. Your Astronomy Engine is truly remarkable, and you seem to be a genius.
Thank you for your kind words! Feel free to open issues or discussions at any time you have questions/comments.
I am very interested in the amazing Astronomy Engine you created. I tested the sunrise and sunset times for May 29, 1917, in Brookline, Massachusetts (latitude 42.33176, longitude -71.12116), USA. The returned sunrise time is 5:11:28 AM on May 30, 1917. The observed sunrise time is 4:12 AM on May 30, 1917, showing an actual difference of one hour. The same goes for the sunset time. Is the code I tested incorrect? The tested code is as follows.
Observer observer = new Observer(42.33176, -71.12116, 0.0); DateTime dtRise = DateTime.MinValue;
AstroTime time = new AstroTime(dtYMDH); AstroTime riseTime = Astronomy.SearchRiseSet(Body.Sun, observer, Direction.Rise, time, 300.0);
dtRise = riseTime.ToUtcDateTime(); dtRise = TimeZoneInfo.ConvertTimeFromUtc(dtRise, tzi);