source: buchla-68k/orig/DATE/SUNBUGS.txt@ a838f5b

Last change on this file since a838f5b was 3ae31e9, checked in by Thomas Lopatic <thomas@…>, 8 years ago

Imported original source code.

  • Property mode set to 100755
File size: 4.9 KB
RevLine 
[3ae31e9]1From qantel!dual!lll-crg!gymble!umcp-cs!seismo!harvard!talcott!panda!genrad!decvax!tektronix!reed!nsc-pdc!rgb Fri Jun 7 14:58:02 1985
2Relay-Version: version B 2.10.2 9/18/84; site qvax2.UUCP
3Posting-Version: version B 2.10.2 9/5/84; site nsc-pdc.UUCP
4Path: qvax2!qantel!dual!lll-crg!gymble!umcp-cs!seismo!harvard!talcott!panda!genrad!decvax!tektronix!reed!nsc-pdc!rgb
5From: rgb@nsc-pdc.UUCP (Robert Bond)
6Newsgroups: net.sources.bugs
7Subject: Re: Bug in sunrise/sunset program
8Message-ID: <206@nsc-pdc.UUCP>
9Date: 7 Jun 85 21:58:02 GMT
10Date-Received: 13 Jun 85 10:02:27 GMT
11References: <77@wcom.UUCP> <144@hoqam.UUCP> <146@hoqam.UUCP>
12Reply-To: rgb@nsc-pdc.UUCP (Robert Bond)
13Distribution: net
14Organization: NSC Portland, Orygun
15Lines: 185
16
17Here are the promised fixes for the Volks.. er.. 286 type machines.
18Feed this to patch or try it by hand.
19
20If any Microsoft/ IBM support types are interested in C compiler bugs
21or broken #include files, please drop me a line.
22
23 Bob Bond
24
25*** sun.c.rel Thu Jun 6 15:58:09 1985
26--- sun.c Thu Jun 6 15:56:51 1985
27***************
28*** 11,17
29 *
30 * All output is to standard io.
31 *
32! * Compile with cc -O -o sun -lm
33 * Non 4.2 systems may have to change <sys/time.h> to <time.h> below.
34 *
35 * Note that the latitude, longitude, time zone correction and
36
37--- 11,17 -----
38 *
39 * All output is to standard io.
40 *
41! * Compile with cc -O -o sun sun.c -lm
42 * Non 4.2 systems may have to change <sys/time.h> to <time.h> below.
43 *
44 * Note that the latitude, longitude, time zone correction and
45***************
46*** 51,56
47 double cos_deg();
48 double tan_deg();
49 double gmst();
50
51 int th;
52 int tm;
53
54--- 51,58 -----
55 double cos_deg();
56 double tan_deg();
57 double gmst();
58+ struct tm *localtime();
59+ long time();
60
61 int th;
62 int tm;
63***************
64*** 77,83
65 double lambda1, lambda2;
66 double alt, az, gst, m1;
67 double hsm, ratio;
68! time_t sec_1970;
69 int h, m;
70 struct tm *pt;
71
72
73--- 79,85 -----
74 double lambda1, lambda2;
75 double alt, az, gst, m1;
76 double hsm, ratio;
77! long sec_1970;
78 int h, m;
79 struct tm *pt;
80
81***************
82*** 139,145
83 da = asin_deg(tan_deg(x)/tan_deg(tri));
84 dt = 240.0 * y / cos_deg(delta) / 3600;
85
86! lst_to_hm(trise - dt, jd, &h, &m);
87 printf("Sunrise: %2d:%02d ", h, m);
88
89 if (popt) {
90
91--- 145,152 -----
92 da = asin_deg(tan_deg(x)/tan_deg(tri));
93 dt = 240.0 * y / cos_deg(delta) / 3600;
94
95! trise -= dt;
96! lst_to_hm(trise, jd, &h, &m);
97 printf("Sunrise: %2d:%02d ", h, m);
98
99 if (popt) {
100***************
101*** 147,153
102 printf("Azimuth: %2d deg %02d min \n", h, m);
103 }
104
105! lst_to_hm(tset + dt, jd, &h, &m);
106 printf("Sunset: %2d:%02d ", h, m);
107
108 if (popt) {
109
110--- 154,161 -----
111 printf("Azimuth: %2d deg %02d min \n", h, m);
112 }
113
114! tset += dt;
115! lst_to_hm(tset, jd, &h, &m);
116 printf("Sunset: %2d:%02d ", h, m);
117
118 if (popt) {
119***************
120*** 286,292
121 double
122 julian_date(m, d, y)
123 {
124! int a, b;
125 double jd;
126
127 if (m == 1 || m == 2) {
128
129--- 294,300 -----
130 double
131 julian_date(m, d, y)
132 {
133! long a, b;
134 double jd;
135
136 if (m == 1 || m == 2) {
137***************
138*** 298,306
139 exit(1);
140 }
141 a = y/100;
142! b = 2 - a + a/4;
143! b += (int)((double)y * 365.25);
144! b += (int)(30.6001 * ((double)m + 1.0));
145 jd = (double)d + (double)b + 1720994.5;
146 return(jd);
147 }
148
149--- 306,314 -----
150 exit(1);
151 }
152 a = y/100;
153! b = 2 - a + a/4;
154! b += (long)((double)y * 365.25);
155! b += (long)(30.6001 * ((double)m + 1.0));
156 jd = (double)d + (double)b + 1720994.5;
157
158 return(jd);
159***************
160*** 439,447
161 gst -= 24.0;
162 jzjd = julian_date(1,0,yr);
163 ed = jd-jzjd;
164! t = (jzjd -2415020.0)/36525.0;
165! r = 6.6460656+2400.05126*t+2.58E-05*t*t;
166! b = 24-(r-24*(yr-1900));
167 t0 = ed * 0.0657098 - b;
168 if (t0 < 0.0)
169 t0 += 24;
170
171--- 449,457 -----
172 gst -= 24.0;
173 jzjd = julian_date(1,0,yr);
174 ed = jd-jzjd;
175! t = (jzjd -2415020.0) / 36525.0;
176! r = 6.6460656 + 2400.05126 * t + 2.58E-05 * t * t;
177! b = 24.0 - ( r - 24.0 * ( yr - 1900.0));
178 t0 = ed * 0.0657098 - b;
179 if (t0 < 0.0)
180 t0 += 24;
181***************
182*** 448,454
183 gmt = gst-t0;
184 if (gmt<0)
185 gmt += 24.0;
186! gmt = gmt * 0.99727 - tz;;
187 if (gmt < 0)
188 gmt +=24.0;
189 dh_to_hm(gmt, h, m);
190
191--- 458,464 -----
192 gmt = gst-t0;
193 if (gmt<0)
194 gmt += 24.0;
195! gmt = gmt * 0.99727 - tz;
196 if (gmt < 0)
197 gmt +=24.0;
198 dh_to_hm(gmt, h, m);
199--
200 Robert Bond nsc!nsc-pdc!rgb
201 National Semiconductor tektronix!reed!nsc-pdc!rgb
202
203
204
Note: See TracBrowser for help on using the repository browser.