From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: "A. Guru" Newsgroups: gmane.emacs.xemacs.beta,gmane.emacs.bugs 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 Sender: xemacs-beta-admin@xemacs.org Message-ID: <20020922145402.A31756@localhost.localdomain> NNTP-Posting-Host: localhost.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1032810991 2000 127.0.0.1 (23 Sep 2002 19:56:31 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Mon, 23 Sep 2002 19:56:31 +0000 (UTC) Cc: bug-gnu-emacs@gnu.org, xemacs-beta@xemacs.org Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 17tZJl-0000W6-00 for ; Mon, 23 Sep 2002 21:56:29 +0200 Original-Received: from gwyn.tux.org ([199.184.165.135]) by quimby.gnus.org with esmtp (Exim 3.12 #1 (Debian)) id 17ta0C-0001AC-00 for ; Mon, 23 Sep 2002 22:40:20 +0200 Original-Received: from gwyn.tux.org (localhost.localdomain [127.0.0.1]) by gwyn.tux.org (8.9.3/8.9.1) with ESMTP id PAA24302; Mon, 23 Sep 2002 15:52:46 -0400 Original-Received: (from turnbull@localhost) by gwyn.tux.org (8.9.3/8.9.1) id PAA23743 for xemacs-beta-mailman@xemacs.org; Mon, 23 Sep 2002 15:50:39 -0400 Original-Received: (from mail@localhost) by gwyn.tux.org (8.9.3/8.9.1) id PAA23703 for turnbull@tux.org; Mon, 23 Sep 2002 15:50:35 -0400 Original-Received: from yxa.extundo.com (178.230.13.217.in-addr.dgcsystems.net [217.13.230.178]) by gwyn.tux.org (8.9.3/8.9.1) with ESMTP id PAA23672 for ; Mon, 23 Sep 2002 15:50:30 -0400 Original-Received: from tomts17-srv.bellnexxia.net (tomts17.bellnexxia.net [209.226.175.71]) by yxa.extundo.com (8.12.6/8.12.6) with ESMTP id g8MIvsn2015692 for ; Sun, 22 Sep 2002 20:57:55 +0200 Original-Received: from localhost.localdomain ([65.92.194.53]) by tomts17-srv.bellnexxia.net (InterMail vM.5.01.04.19 201-253-122-122-119-20020516) with ESMTP id <20020922185404.TTCE3718.tomts17-srv.bellnexxia.net@localhost.localdomain>; Sun, 22 Sep 2002 14:54:04 -0400 Original-Received: (from guru@localhost) by localhost.localdomain (8.11.6/8.11.6) id g8MIs2d32274; Sun, 22 Sep 2002 14:54:02 -0400 Original-To: "Edward M. Reingold" , "Denis B. Roegel" Content-Disposition: inline User-Agent: Mutt/1.2.5.1i X-XEmacs-List: beta Errors-To: xemacs-beta-admin@xemacs.org X-BeenThere: xemacs-beta@xemacs.org X-Mailman-Version: 2.0.13 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: XEmacs Beta Testers List-Unsubscribe: , Xref: main.gmane.org gmane.emacs.xemacs.beta:5303 gmane.emacs.bugs:3556 X-Report-Spam: http://spam.gmane.org/gmane.emacs.bugs:3556 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) ========