program jd; { Berechne julianisches Datum und Greenwich Mean Siderial Time }

type
   ZEIT = record
             stunde:0..23;
             minute,sekunde:0..59
          end;

   DATUM = record
              jahr:integer;
              monat:1..12;
              tag:1..31
           end;

   JUL = record
            ganz:long_integer;
            fract:real
         end;

var dummy:integer;
    c:char;
    gmst,lokal:ZEIT;
    jd:JUL;
    date:DATUM;
    greg:boolean;

procedure juldat(var julian:JUL; gregorian:DATUM; uhrzeit:ZEIT; flag:boolean);
external;

procedure sidtime(var sternzeit:ZEIT; julian:JUL);
external;

begin
   writeln(chr(27),
           'H< CALCULATE JULIAN DATE AND GREENWICH MEAN SIDERIAL TIME >');
   writeln;
   write('> Date yyyy mm dd : '); readln(date.jahr,date.monat,date.tag);
   write('> Greg. (y/n)     : '); read(c);
   if c = 'y' then greg := true else greg := false;
   writeln;
   write('> Time hh mm ss   : ');
   readln(lokal.stunde,lokal.minute,lokal.sekunde);
   writeln; writeln;
   juldat(jd,date,lokal,greg);
   writeln('  Julian date                  : ',jd.ganz,jd.fract:10:6);
   sidtime(gmst,jd);
   writeln('  Greenwich Mean Siderial Time : ',
            gmst.stunde:3,gmst.minute:3,gmst.sekunde:3);
   while not keypress do ;
end.


