The QBasic / QB64 Discussion Forum      Other Subforums, Links and Downloads
 
 

 Return to Index  

about search for planet and timezones find this

November 17 2011 at 9:41 PM
Anonymous  (no login)

 
not tested

http://www.spaceacademy.net.au/spacelab/projects/marsclok/marsclok.htm.





100 DIM loc$(10), lat(10), lon(10) 'MARS CLOCK [MARSCLOK.BAS]
110 DEFDBL A-Z: pi = 3.141592653#: dr = pi / 180: i = 0
120 OPEN "marsclok.dat" FOR INPUT AS #1: INPUT #1, tz$, tz
130 DO WHILE NOT EOF(1): INPUT #1, loc$(i), lat(i), lon(i)
140 i = i + 1: LOOP: CLOSE #1: MD = 24.65979: il = 0
150 CLS : COLOR 14, 0: PRINT " MARS CLOCK": esc$ = CHR$(27)
160 COLOR 10, 0: LOCATE 3, 9: PRINT "EARTH TIME"
170 dt$ = DATE$: tM$ = TIME$: ut = TIMER / 86400 - tz / 24
180 PRINT : PRINT , dt$, tM$; " "; tz$; " = UT + "; tz

200 yr = VAL(RIGHT$(dt$, 4)): mn = VAL(LEFT$(dt$, 2))
210 dy = VAL(MID$(dt$, 4, 2)): dyt = dy + ut: srs = 90.25 * dr
220 PRINT : COLOR 12, 0: PRINT " MARS PARAMETERS"
230 mlat = lat(il): mlon = lon(il): mloc$ = loc$(il)
240 COLOR 13, 0: PRINT : PRINT , "LOCATION - "; mloc$; " ";
250 PRINT USING "Lat ###.# Lon ####.#"; mlat; mlon: PRINT

300 N = INT(yr + FIX((mn - 9) / 7))
310 N = -INT(3 * (INT(N / 100) + 1) / 4)
320 N = N - INT(7 * (INT((mn + 9) / 12) + yr) / 4)
330 N = N - 730516.5 + dyt + 367 * yr + INT(275 * mn / 9)

400 tM = N - 4.5: MSD = 44795.99976# + tM * 24 / MD + mlon / 360!
420 MSH = (MSD - INT(MSD)) * 24
430 MSM = (MSH - INT(MSH)) * 60: MSHh = INT(MSH)
440 Myr = INT(MSD / 668.5921)
450 Mday = INT(MSD - INT(Myr * 668.5921))

500 M = (19.41 + .5240212# * N) * dr: sM = SIN(M): cM = COS(M)
510 Afms = Afms - INT(Afms / 360) * 360: s2M = SIN(2 * M)
520 Afms = 270.39 + .5240384# * N: s3M = SIN(3 * M): s4M = SIN(4 * M)
540 Ls = Afms + (10.691 + 3.7E-07 * N) * sM + .623 * s2M
550 Ls = Ls + .05 * s3M + .005 * s4M: Lr = Ls * dr
560 RA = Ls - 2.86 * SIN(2 * Lr) + .071 * SIN(4 * Lr) - .002 * SIN(6 * Lr)
570 EoT = (Afms - RA) / 15: MTST = MSH + EoT: Ls = Ls - INT(Ls / 360) * 360
580 MTSTh = INT(MTST): MTSTm = (MTST - MTSTh) * 60
590 MTSTh = MTSTh - INT(MTSTh / 24) * 24

600 sDec = .4256 * SIN(Lr): c2M = COS(2 * M)
610 Dec = ATN(sDec / SQR(1 - sDec * sDec)) / dr + .25 * SIN(Lr)
620 rM = 1.00436 - .09309 * cM - .00436 * c2M
630 rM = rM - .00031 * COS(3 * M): rM = 1.5236 * rM
640 LM = Ls + 85.06 + .000029 * N: LM = LM - INT(LM / 360) * 360
650 Le = 100.472 + .9856474 * N: Le = Le - INT(Le / 360) * 360
660 G = (357.528 + .9856003 * N) * dr
670 LA = Le + 1.915 * SIN(G) + .02 * SIN(2 * G)
680 rE = 1.00014 - .01671 * COS(G) - .00014 * COS(2 * G)
690 rME = SQR(rE * rE + rM * rM - 2 * rE * rM * COS((LM - LA) * dr))

700 ha = 15 * (MSH - 12 + EoT)
710 ha = ha - INT(ha / 360) * 360: IF ha > 180 THEN ha = ha - 360
715 sl = SIN(mlat * dr): cl = COS(mlat * dr): sD = SIN(Dec * dr)
720 SE = sl * sD: cD = COS(Dec * dr)
730 SE = SE + cl * cD * COS(ha * dr): hah = ha / 15
740 IF SE = 1 THEN el = 90: az = 0: GOTO 800
750 el = ATN(SE / SQR(1 - SE * SE)) / dr: az = 90
760 cA = (sD - sl * SE) / cl / SQR(1 - SE * SE): IF cA = 0 THEN 790
770 az = ATN(SQR(ABS(1 - cA * cA)) / cA) / dr
780 IF az < 0 THEN az = 180 + az
790 IF ha > 0 THEN az = 360 - az

800 CMP = 12 - EoT: sha = (COS(srs) - sl * sD) / cl / cD
810 IF ABS(sha) > 1 THEN sr = 0: ss = 0: GOTO 850
820 sha = ATN(SQR(1 - sha * sha) / sha) / dr / 15
830 IF sha < 0 THEN sha = sha + 12
840 sr = CMP - sha: ss = CMP + sha
850 srh = INT(sr): srm = (sr - srh) * 60: srh = (srh + 24) MOD 24
860 ssh = INT(ss): ssm = (ss - ssh) * 60: srh = (srh + 24) MOD 24
870 dl = ss - sr: IF dl < 0 THEN dl = dl + 24
880 IF dl = 0 AND el > 0 THEN dl = 24
890 tME = rME * 499 / 60: rMm = rM * 150: rMEm = rME * 150

900 COLOR 14, 0: PRINT , "Mars Mean Local Time ";
905 PRINT USING "##:##"; MSHh; MSM: PRINT , "Mars Date Year ";
910 PRINT USING "### ME Day ### [MSD=######.###]"; Myr; Mday; MSD
915 PRINT : COLOR 12, 0: PRINT , "Mars True Solar Time ";
920 PRINT USING "##:## [EoT = ###.# minutes]"; MTSTh; MTSTm; EoT * 60
925 PRINT , ; : PRINT USING "Solar Longitude Ls = ###.## deg"; Ls
930 PRINT , ; : PRINT USING "Solar Dec = ###.# deg "; Dec;
935 PRINT USING "HA = ###.# hours"; hah: PRINT , ;
940 PRINT USING "Solar Elevation = ### deg Azimuth = ### deg"; el; az
945 COLOR 9, 0: PRINT : PRINT , ;
950 PRINT USING "Distance to Sun = #.## AU ###.# million km"; rM; rMm
955 PRINT , ; : PRINT USING "Distance to Earth = #.## AU "; rME;
960 PRINT USING "###.# million km"; rMEm: COLOR 7, 0: PRINT : PRINT , ;
965 PRINT USING "Communications Delay ##.# minutes (E-M)"; tME
970 PRINT : COLOR 14, 0: PRINT , ; : PRINT "Sunrise ";
975 PRINT USING "##:## Sunset ##:##"; srh; srm; ssh; ssm;
980 PRINT USING " Hours of Daylight ##.#"; dl;

990 a$ = INKEY$: IF a$ <> "" THEN il = VAL(a$)
999 IF a$ <> esc$ THEN 160











MARSCLOK Data File [MARSCLOK.DAT]
WAST,8
"Prime Meridian",0,0
"Airy Crater ",-5.2,0
"Mars 2 ",-45,58
"Viking 1 ",22.48,-47.95
"Viking 2 ",47.70,134.28
"Pathfinder ",19.28,-33.55
"Spirit ",-14.74,175.48
"Opportunity ",-1.98,-5.94
"Beagle 2 ",11.6,90.5
"Prime Meridian",0,0








Time Zones
UT or GMT (England or Scientific) 0
EST (Eastern Standard Time -USA) -5
CST (Central Standard Time - USA) -6
MST (Mountain Standard Time - USA) -7
PST (Pacific Standard Time - USA) -8
AEST Australian Eastern Standard Time +10
CAST Central Australian Standard Time +9.5
WAST West Australian Standard Time +8
[ for Daylight (Saving) Times add 1 to above times (eg EDT = -4, AEDT = +11) ]





 
 Respond to this message   
Response TitleAuthor and Date
now testedAnonymous on Dec 4
   yesAnonymous on Dec 4
 Copyright © 1999-2014 Network54. All rights reserved.   Terms of Use   Privacy Statement  

Newbies usually go to www.qbasic.com and click on The QBasic Forum
Forum regulars have their own ways, which include The QBasic Community Forums