all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "A. Guru" <a.guru@sympatico.ca>
Cc: bug-gnu-emacs@gnu.org, xemacs-beta@xemacs.org
Subject: [calendar/solar.el] patch for equinox/dst bug (GNU Emacs 21.2 and XEmacs 21.4.6)
Date: Sun, 22 Sep 2002 14:54:02 -0400	[thread overview]
Message-ID: <20020922145402.A31756@localhost.localdomain> (raw)

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) ========



                 reply	other threads:[~2002-09-22 18:54 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20020922145402.A31756@localhost.localdomain \
    --to=a.guru@sympatico.ca \
    --cc=bug-gnu-emacs@gnu.org \
    --cc=xemacs-beta@xemacs.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.