% time of local noon
% Computed from your time zone and longitude:
% 1.Compute your longitude in decimal form: degrees + (minutes/60) +
(seconds/3600). If
% you're in the Eastern Hemisphere, make this a negative number.
dms=input('type in degrees, minutes and seconds');
deg=dms(1);
min=dms(2);
sec=dms(3);
e=input('Are you in the Eastern Hemisphere? (yes - 1, no - 0) ');
long=deg+min/60+sec/3600;
% 2.Compute your "standard meridian" (the longitude of the center
% of your time zone):
% difference in hours between your time and "Universal time"
% (Greenwich or Zulu time)
% times 15 (for example, the US Central time zone is six hours different,
% times 15 means that
% the "standard meridian" for the Central Time Zone is 90 degrees).
% Make this a negative number if you're in the Eastern Hemisphere.
tz=input('time zone: 1: eastern, 2: central, 3: mountain, 4: pacific ');
sm=(tz+4)*15;
% 3.Subtract the standard meridian from your longitude.
dif=long-sm;
% 4.Divide that difference by 15 to get the longitude deviation time
% (the amount that your local
% time is ahead or behind the clock time for your time zone)
% 5.Add 0.123 to that time (the correction for the deviation between
% the way our clocks/calendars work and the way the earth/sun work:
% this is found in the current Almanac
% For a given date - in this case, 0.123 for March 20th)
dev=dif/15+0.123
% 6.Add the resulting number to 12 (or subtract it from 12 if it is
% negative) to get the time of your local noon.
noon=12+dev
% 7.Convert the decimal number to hours, minutes, and seconds.
whole=fix(noon)
% 1.The whole number is the hours.
% 2.Multiply the fraction by 60. The whole number is the minutes.
left=(noon-whole)*60;
min=fix(left);
sec=(left-min)*60;
% 3.Multiply the fraction by 60. The results is the seconds.
disp('whole min sec');
disp([whole min sec]);
% (Crazy system we have for time!)
%
% For example, in the case of Lancaster Pennsylvania, at longitude
% 76 degrees, 17 minutes, and 0 seconds in the Eastern Standard Time
% zone (5), the decimal longitude is 76.28, the standard meridian
% is 75 degrees, the deviation in longitude is +1.28 degrees,
% the deviation in time is +0.08, the correction is +0.12, the
% local noon time is 12.20, which is 12:12 PM. So their Noon
% Observations should start before 12:12 and end after that in order
% to capture local noon.