emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r103950: solar.el fixes.


From: Glenn Morris
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r103950: solar.el fixes.
Date: Tue, 19 Apr 2011 19:09:06 -0700
User-agent: Bazaar (2.3.1)

------------------------------------------------------------
revno: 103950
committer: Glenn Morris <address@hidden>
branch nick: trunk
timestamp: Tue 2011-04-19 19:09:06 -0700
message:
  solar.el fixes.
  
  * lisp/calendar/solar.el (solar-horizontal-coordinates):
  Use the longitude argument rather than `calendar-longitude' (15yr old bug).
  (solar-date-next-longitude): Remove unused locals.
modified:
  lisp/ChangeLog
  lisp/calendar/solar.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2011-04-19 15:33:34 +0000
+++ b/lisp/ChangeLog    2011-04-20 02:09:06 +0000
@@ -1,3 +1,9 @@
+2011-04-20  Glenn Morris  <address@hidden>
+
+       * calendar/solar.el (solar-horizontal-coordinates):
+       Use the longitude argument rather than `calendar-longitude'.
+       (solar-date-next-longitude): Remove unused locals.
+
 2011-04-19  Stefan Monnier  <address@hidden>
 
        * progmodes/octave-mod.el (octave-in-comment-p, octave-in-string-p)

=== modified file 'lisp/calendar/solar.el'
--- a/lisp/calendar/solar.el    2011-01-26 08:36:39 +0000
+++ b/lisp/calendar/solar.el    2011-04-20 02:09:06 +0000
@@ -453,7 +453,7 @@
          (st (+ solar-sidereal-time-greenwich-midnight
                 (* ut 1.00273790935)))
          ;; Hour angle (in degrees).
-         (ah (- (* st 15) (* 15 (car ec)) (* -1 (calendar-longitude))))
+         (ah (- (* st 15) (* 15 (car ec)) (* -1 longitude)))
          (de (cadr ec))
          (azimuth (solar-atn2 (- (* (solar-cosine-degrees ah)
                                     (solar-sin-degrees latitude))
@@ -771,26 +771,22 @@
 `calendar-daylight-savings-starts-time', `calendar-daylight-savings-ends',
 `calendar-daylight-savings-ends-time', `calendar-daylight-time-offset',
 and `calendar-time-zone' are used to interpret local time."
-  (let* ((long)
-         (start d)
-         (start-long (solar-longitude d))
-         (next (mod (* l (1+ (floor (/ start-long l)))) 360))
-         (end (+ d (* (/ l 360.0) 400)))
-         (end-long (solar-longitude end)))
-    (while                       ; bisection search for nearest minute
-        (< 0.00001 (- end start))
-      ;; start   <= d    < end
+  (let ((start d)
+        (next (mod (* l (1+ (floor (/ (solar-longitude d) l)))) 360))
+        (end (+ d (* (/ l 360.0) 400)))
+        long)
+    ;; Bisection search for nearest minute.
+    (while (< 0.00001 (- end start))
+      ;; start <= d < end
       ;; start-long <= next < end-long when next != 0
-      ;; when next = 0, we look for the discontinuity (start-long is near 360
-      ;;                and end-long is small (less than l).
+      ;; when next = 0, look for the discontinuity (start-long is near 360
+      ;; and end-long is small (less than l)).
       (setq d (/ (+ start end) 2.0)
             long (solar-longitude d))
       (if (or (and (not (zerop next)) (< long next))
               (and (zerop next) (< l long)))
-          (setq start d
-                start-long long)
-        (setq end d
-              end-long long)))
+          (setq start d)
+        (setq end d)))
     (/ (+ start end) 2.0)))
 
 ;; FIXME but there already is solar-sunrise-sunset.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]