Subject: Re: bug#45818: 28.0.50; Test solar-sunrise-sunset fails

From: "Basil L. Contovounesios" <[email-masked]>
Date: Tue, 12 Jan 2021 20:06:30 +0000

Mattias Engdegård <[email-masked]> writes:

> Could you try tracking down the origin of those numbers? Here is a trace of some
> of the relevant functions on my machines:
>
> 1 -> (solar-sunrise-sunset (12 30 2020))
> | 2 -> (solar-exact-local-noon (12 30 2020))
> | | 3 -> (solar-julian-ut-centuries (12 30 2020))
> | | 3 <- solar-julian-ut-centuries: 0.2099520876112252
> | 2 <- solar-exact-local-noon: ((12 30 2020) 6.9905251059993585)
> | 2 -> (solar-julian-ut-centuries (12 30 2020))
> | 2 <- solar-julian-ut-centuries: 0.2099520876112252
> | 2 -> (solar-sidereal-time 0.2099520876112252)
> | 2 <- solar-sidereal-time: 6.592887211896198
> | 2 -> (solar-sunrise-and-sunset (0.2099520876112252 6.9905251059993585) 1.0 75.8 0)
> | 2 <- solar-sunrise-and-sunset: (6.5198219809993585 18.46122823099936 11.941406250000002)
> | 2 -> (solar-sunrise-and-sunset (0.2099520876112252 6.9905251059993585) 26.9 75.8 -0.61)
> | 2 <- solar-sunrise-and-sunset: (7.2698219809993585 17.71122823099936 10.441406250000002)
> | 2 -> (dst-adjust-time (12 30 2020) 7.2698219809993585)
> | 2 <- dst-adjust-time: ((12 30 2020) 7.2666666666045785 "IST")
> | 2 -> (dst-adjust-time (12 30 2020) 17.71122823099936)
> | 2 <- dst-adjust-time: ((12 30 2020) 17.716666666790843 "IST")
> | 2 -> (calendar-date-equal (12 30 2020) (12 30 2020))
> | 2 <- calendar-date-equal: t
> | 2 -> (calendar-date-equal (12 30 2020) (12 30 2020))
> | 2 <- calendar-date-equal: t
> 1 <- solar-sunrise-sunset: ((7.2666666666045785 #1="IST") (17.716666666790843 #1#) "10:26")

Here's my version of this trace:

1 -> (solar-sunrise-sunset (12 30 2020))
| 2 -> (solar-exact-local-noon (12 30 2020))
| | 3 -> (solar-julian-ut-centuries (12 30 2020))
| | 3 <- solar-julian-ut-centuries: 0.2099520876112252
| 2 <- solar-exact-local-noon: ((12 30 2020) 6.9905251059993585)
| 2 -> (solar-julian-ut-centuries (12 30 2020))
| 2 <- solar-julian-ut-centuries: 0.2099520876112252
| 2 -> (solar-sidereal-time 0.2099520876112252)
| 2 <- solar-sidereal-time: 6.592887211896198
| 2 -> (solar-sunrise-and-sunset (0.2099520876112252 6.9905251059993585) 1.0 75.8 0)
| 2 <- solar-sunrise-and-sunset: (6.5198219809993585 18.46122823099936 11.941406250000002)
| 2 -> (solar-sunrise-and-sunset (0.2099520876112252 6.9905251059993585) 26.9 75.8 -0.61)
| 2 <- solar-sunrise-and-sunset: (7.2698219809993585 17.71122823099936 10.441406250000002)
| 2 -> (dst-adjust-time (12 30 2020) 7.2698219809993585)
| 2 <- dst-adjust-time: ((12 30 2020) 6.266666667535901 "IST")
| 2 -> (dst-adjust-time (12 30 2020) 17.71122823099936)
| 2 <- dst-adjust-time: ((12 30 2020) 16.716666667722166 "IST")
| 2 -> (calendar-date-equal (12 30 2020) (12 30 2020))
| 2 <- calendar-date-equal: t
| 2 -> (calendar-date-equal (12 30 2020) (12 30 2020))
| 2 <- calendar-date-equal: t
1 <- solar-sunrise-sunset: ((6.266666667535901 #1="IST") (16.716666667722166 #1#) "10:26")

So I'm guessing dst-adjust-time adjusts for DST in my locale (based on
some cache), but not yours?  The following change lets the test succeed
for me:

diff --git a/test/lisp/calendar/solar-tests.el b/test/lisp/calendar/solar-tests.el
index 7a37f8db55..dff64635e5 100644
--- a/test/lisp/calendar/solar-tests.el
+++ b/test/lisp/calendar/solar-tests.el
@@ -26,7 +26,7 @@ solar-sunrise-sunset
         (calendar-longitude 75.8)
         (calendar-time-zone +330)
         (calendar-standard-time-zone-name "IST")
-        (calendar-daylight-time-zone-name "IST")
+        (calendar-daylight-savings-starts nil)
         (epsilon (/ 60.0)))             ; Minute accuracy is good enough.
     (let* ((sunrise-sunset (solar-sunrise-sunset '(12 30 2020)))
            (sunrise (car (nth 0 sunrise-sunset)))

Does it look like TRT?  Thanks,

-- 
Basil