Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mismatched times when device timezone and input lat/lon are different #61

Open
chiliLime opened this issue Mar 23, 2023 · 0 comments
Open

Comments

@chiliLime
Copy link

I am getting some incorrect results on my iOS simulator with the following conditions:

  • IOS simulator timezone PDT (in California)
  • Lat/Lon for solar events: latitude: 32.845753, longitude: -96.852206 (Dallas, Texas)

Returned results:

solarEvent: Optional(Solar.Solar(coordinate: __C.CLLocationCoordinate2D(latitude: 32.845753, longitude: -96.852206), date: 2023-03-27 04:46:28 +0000, sunrise: Optional(2023-03-27 12:22:16 +0000), sunset: Optional(2023-03-28 00:43:56 +0000), civilSunrise: Optional(2023-03-27 11:57:33 +0000), civilSunset: Optional(2023-03-28 01:08:40 +0000), nauticalSunrise: Optional(2023-03-27 11:28:37 +0000), nauticalSunset: Optional(2023-03-28 01:37:37 +0000), astronomicalSunrise: Optional(2023-03-27 10:59:16 +0000), astronomicalSunset: Optional(2023-03-28 02:07:00 +0000)))
for lat, lon: 32.845753 -96.852206

These results in GMT are all exactly two hours earlier than would be the correct times in Dallas. This seems to correlate with the two hour time difference between my simulator (PDT) and the lat/lon given (CDT).

Possible cause:
The Solar struct initializes its property 'self.date' using Date(), which will take the time from the device. So when the solar events are requested in a timezone different from the device this can lead to a time offset.

I hope this helps!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant