define SZ_GEISTIME 24 define SZ_MONTH 3 # geistime_mjd -- convert a GEIS file time string to MJD. # This routine converts a time string in a GEIS file's group parameters # to a modified Julian day. The format of the time string is # DD-MMM-YYYY HH:MM:SS.SS, e.g. 01-JAN-1986 12:00:00.00. # # Date Author Description # ---- ------ ----------- # 25-Jan-1990 J.-C. Hsu design and code #------------------------------------------------------------------------------ procedure geistime_mjd (timestring, mjd) char timestring[SZ_GEISTIME] # input: GEIS time string double mjd # outpit: modified Julian day char monthch[SZ_MONTH] int year, month int ip double day, hour char str[SZ_LINE] int strdic(), ctoi(), ctod() #============================================================================== begin str[1] = EOS # convert time string to lower case, and then dissect each field call strlwr (timestring) call amovc (timestring[4], monthch, SZ_MONTH) monthch[4] = EOS ip = 1 if (ctod (timestring, ip, day) < 1) call error (1, "can't read day in time string") ip = 8 if (ctoi (timestring, ip, year) < 1) call error (1, "can't read year in time string") ip = 13 if (ctod (timestring, ip, hour) < 1) call error (1, "can't read hour/min/sec in time string") day = day + hour / 24.d0 # Month month = strdic (monthch, monthch, SZ_MONTH, "|jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec|") if (month < 1) { call strcat ("illegal month: ", str, SZ_LINE) call strcat (monthch, str, SZ_LINE) call error (1, str) } call cdmjd (year, month, day, mjd) end