summaryrefslogtreecommitdiff
path: root/lisp/calendar/solar.el
diff options
context:
space:
mode:
authorMattias EngdegÄrd <mattiase@acm.org>2020-10-26 18:44:05 +0100
committerMattias EngdegÄrd <mattiase@acm.org>2020-10-27 12:33:51 +0100
commitcde72637dfd6989081ed8b2f26e7187c309780b8 (patch)
tree1784cc7c3cb1edacd353276fbe1bf422d0b71a2c /lisp/calendar/solar.el
parentf971a612a92eea4c8aab6b002d7998bb0b6f5ca1 (diff)
downloademacs-cde72637dfd6989081ed8b2f26e7187c309780b8.tar.gz
Fix sunrise and sunset calculation (bug#44237)
* lisp/calendar/solar.el (solar-moment): Use initial values for binary search that won't end the loop prematurely and yield incorrect answers. * test/lisp/calendar/solar-tests.el: New file.
Diffstat (limited to 'lisp/calendar/solar.el')
-rw-r--r--lisp/calendar/solar.el4
1 files changed, 2 insertions, 2 deletions
diff --git a/lisp/calendar/solar.el b/lisp/calendar/solar.el
index 05bb3164e12..07562f62240 100644
--- a/lisp/calendar/solar.el
+++ b/lisp/calendar/solar.el
@@ -490,8 +490,8 @@ Uses binary search."
(utmin (+ ut (* direction 12.0)))
(utmax ut) ; the time searched is between utmin and utmax
;; utmin and utmax are in hours.
- (utmoment-old 0.0) ; rise or set approximation
- (utmoment 1.0) ; rise or set approximation
+ (utmoment-old utmin) ; rise or set approximation
+ (utmoment utmax) ; rise or set approximation
(hut 0) ; sun height at utmoment
(t0 (car time))
(hmin (cadr (solar-horizontal-coordinates (list t0 utmin)