unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* [calendar/solar.el] patch for equinox/dst bug (GNU Emacs 21.2 and XEmacs 21.4.6)
@ 2002-09-22 18:54 A. Guru
  0 siblings, 0 replies; only message in thread
From: A. Guru @ 2002-09-22 18:54 UTC (permalink / raw)
  Cc: bug-gnu-emacs, xemacs-beta

Hi.

If, like me, you live in the north american Eastern time zone, dayligth
saving time is in effect and the autumnal equinox occurs about today
(2002-09-22).  The problem is, both GNU Emacs and XEmacs reported it to
occur last night at 00:55 while it really occurs tonight at the same time.

The problem is that the date is computed for standard time, and that
would put the equinox at 2002-09-22T23:55 (standard time, which is not
really in effect now).  But the time is adjusted for daylight saving
time and the combination of the wrong date with the right time gives
the incorrect 2002-09-22T00:55 instead of the correct 2002-09-23T00:55.

Here are patches for GNU Emacs and XEmacs, which for some reason have
equivalent but different leading white space made with tabs and spaces
for the same code.  Both patches _look_ exactly the same.

Thanks.


======== GNU Emacs 21.2 (begin) ========
--- solar.el.orig-21.2	Mon Jul 16 03:46:48 2001
+++ solar.el	Sun Sep 22 14:06:51 2002
@@ -1043,9 +1043,10 @@
            (d1 (list (car d0) (floor (car (cdr d0))) (car (cdr (cdr d0)))))
            (h0 (* 24 (- (car (cdr d0)) (floor (car (cdr d0))))))
            (adj (dst-adjust-time d1 h0))
-           (d (list (car d1) (+ (car (cdr d1))  
+	   (d2 (car adj))
+           (d (list (car d2) (+ (car (cdr d2))  
                   (/ (car (cdr adj)) 24.0))
-                    (car (cdr (cdr d1)))))
+                    (car (cdr (cdr d2)))))
            ; The following is nearly as accurate, but not quite:
 	   ;(d0 (solar-date-next-longitude
            ;    (calendar-astro-from-absolute
@@ -1055,14 +1056,14 @@
            ;(abs-day (calendar-absolute-from-astro d)))
            (abs-day (calendar-absolute-from-gregorian d)))
       (list
-       (list (calendar-gregorian-from-absolute (floor abs-day))
+       (list d2
              (format "%s %s"
                      (nth k (if (and calendar-latitude
                                      (< (calendar-latitude) 0))
                                 solar-s-hemi-seasons
                               solar-n-hemi-seasons))
                      (solar-time-string
-                      (* 24 (- abs-day (floor abs-day)))
+                      (car (cdr adj))
                       (if (dst-in-effect abs-day)
                           calendar-daylight-time-zone-name
                         calendar-standard-time-zone-name))))))))
======== GNU Emacs 21.2 (end) ========


======== XEmacs 21.4.6 (begin) ========
--- solar.el.orig-21.4.6	Sat Jan  8 12:45:58 2000
+++ solar.el	Sun Sep 22 14:17:15 2002
@@ -1045,9 +1045,10 @@
            (d1 (list (car d0) (floor (car (cdr d0))) (car (cdr (cdr d0)))))
            (h0 (* 24 (- (car (cdr d0)) (floor (car (cdr d0))))))
            (adj (dst-adjust-time d1 h0))
-           (d (list (car d1) (+ (car (cdr d1))  
+	   (d2 (car adj))
+           (d (list (car d2) (+ (car (cdr d2))  
                   (/ (car (cdr adj)) 24.0))
-                    (car (cdr (cdr d1)))))
+                    (car (cdr (cdr d2)))))
            ; The following is nearly as accurate, but not quite:
           ;(d0 (solar-date-next-longitude
            ;    (calendar-astro-from-absolute
@@ -1057,14 +1058,14 @@
            ;(abs-day (calendar-absolute-from-astro d)))
            (abs-day (calendar-absolute-from-gregorian d)))
       (list
-       (list (calendar-gregorian-from-absolute (floor abs-day))
+       (list d2
 		  (format "%s %s"
                      (nth k (if (and calendar-latitude
                                      (< (calendar-latitude) 0))
                                 solar-s-hemi-seasons
                                     solar-n-hemi-seasons))
                      (solar-time-string
-                      (* 24 (- abs-day (floor abs-day)))
+                      (car (cdr adj))
                       (if (dst-in-effect abs-day)
                           calendar-daylight-time-zone-name
                         calendar-standard-time-zone-name))))))))
======== XEmacs 21.4.6 (end) ========



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2002-09-22 18:54 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-09-22 18:54 [calendar/solar.el] patch for equinox/dst bug (GNU Emacs 21.2 and XEmacs 21.4.6) A. Guru

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).