/      INTEGER*2 FUNCTION DAYFUN (FDS,ALON,IDSC)IC_TITLE  DAYFUN  Viking spacecraft observation Mars day function  (MAWD).C_ARGUMENTSA      INTEGER*4 FDS   ![O] Is the Flight Data System (FDS) count.7      INTEGER*4 ALON  ![I] Is the longitude in degrees.B      INTEGER*2 IDSC  ![I] IDSC is the spacecraft number (1 OR 2).
C_DESCRIPTIONGC    	The integer function DAYFUN is the Viking spacecraft observation EC    day function for Mars.  DAYFUN returns an INTEGER*2 Martian day KC    referenced to 0 degrees longitude at Midnight, with the entire planet KC    experiencing day 1 at the instant of 22H 57M 45S UT on 21 June 1976.  GC    A day is incremented by 1 at each longitude when it crosses local MC    Midnight (based on a mean Mars solar day, referenced to the above date, IC    such that at other seasons a day will increment by 1 near Midnight).TC_HISTORY  Bruce M Jacowsky 83AUG22  CHANGED TO FUNCTION BY R.Mehlman  UCLA  83AUG30C_END'C    IDAY = DAYFUN(FDS,ALON,IDSC) WHERE      INTEGER*4 FDS0(2),KDAY      INTEGER*2 JDAY7      DATA DFDS /317054.1/ , FDS0 /415014255,729362639/HC-----FDS0 CONTAINS S/C 1 & 2 FDS COUNTS AT REFERENCE TIME DEFINED ABOVE      KDAY=FDS-FDS0(IDSC)      DAY=KDAY/DFDS      JDAY=INT(DAY)      FRAC=DAY-JDAY      X=ALON-360.*FRAC!      DAY=JDAY+1.5-0.5*SIGN(1.,X)      DAYFUN=DAY      RETURN	      END