Reconfigure offset calculation to fix UTC rollover. Fixes: #81, #82, and #83, #90
Conversation
offset comparison no longer causes previous day to be returned when local time rolled over UTC date
the offset is actually needed to shift the date by 1. If you don't subtract the delta in the check function on line 882, the value error is thrown.
|
add 5202da6 to apply offset and block value error from being thrown if the date doesn't match by applying delta term. appears to work for PST: |
Still have an issue with singularity when the day length is exactly 12 and sunset is at midnight
|
Ok maybe not as simple of a fix as I thought. Went to test some more locations and miraculously found an edge case that fails the UTC rollover conditions. I randomly picked coords point but somehow stars aligned: Observer: As we can see on 3/18 local date in chicago, sunset is basically at midnight UTC on 3/18. I think because of a floating operation, the offset condition is applied and it bumps the date back to 3/17 UTC causing a singularity. Not sure how best to fix this. |
|
@shanedoolane and @sffjunkie, I'm curious if there's any movement on this or if there are plans on merging this to master? Happy to try to help wherever I can to solve this edge case. |
|
@jlopezarriaza haven't gotten around to fixing yet. Want to pull the branch and look at it? |
|
I'm happy to check it out. I found a workaround by doing things in local time zone rather than UTC, but that doesn't seem optimal. |
|
Hi @shanedoolane a first comment is that a small fix is needed in the functions calculating dusk and dawn in order to run this test code, i.e. but apart of that I see some confusing behaviour: If I test the code with the fix branch I get this output (adding some printout): while when I run with the master branch from the main repo I get this: So there are 3 things that are puzzling me here
|
|
@Voutsi @jlopezarriaza let me take a look over the weekend for a fix |
|
Any update for this one please? |


In my tests validated against real data, this fixes sunset/sunrise issues for the location i'm working with detailed in #83.
offset comparison no longer causes previous day to be returned when local time rolled over UTC date
Test:
Old:

New:
