;+ ; NAME: ; arg_time ; PURPOSE: ; Converts a time argument to a time structure or Carrington variable ; CATEGORY: ; Tell time ; CALLING SEQUENCE: FUNCTION arg_time, ut, carrington=carrington ; INPUTS: ; ut array; type: time structure, float or integer ; times to be converted (UT) ; ; type time structure is interpreted as times in UT ; type float is interpreted as a Carrington variable ; type integer is also interpreted as a Carrington variable, ; UNLESS all values in the input array are less/equal 12. In ; that case the times are interpreted as a difference with the ; system time in hours. ; if ut is undefined then the system time is returned. ; OPTIONAL INPUT PARAMETERS: ; /carrington by default the input is converted to a time structure. ; If /carrington is set than a Carrington variable is returned. ; OUTPUTS: ; ut array; type: time structure or Carrington variable, ; depending on the setting of keyword /carrington ; INCLUDE: @compile_opt.pro ; On error, return to caller ; CALLS: ; InitVar, IsTime, IsType, Carrington, TimeSystem ; PROCEDURE: ; Provides a uniform way to convert times specified as input arguments to functions ; and procedures to either time structures or Carrington variables. ; MODIFICATION HISTORY: ; MAR-2001, Paul Hick (UCSD/CASS; pphick@ucsd.edu) ;- InitVar, carrington, /key CASE carrington OF 0: BEGIN CASE 1 OF IsTime(ut): RETURN, ut IsType(ut, /generic_float ): RETURN, Carrington(ut) IsType(ut, /generic_integer): BEGIN i = where( abs(ut) GT 24 ) CASE i[0] EQ -1 OF 0: RETURN, Carrington(ut) 1: RETURN, TimeSystem(ut,/silent) ; ut is offset between local time and ut ENDCASE END ELSE: RETURN, TimeSystem(/silent) ENDCASE END 1: BEGIN CASE 1 OF IsTime(ut): RETURN, Carrington(ut) IsType(ut, /generic_float ): RETURN, ut IsType(ut, /generic_integer): BEGIN i = where( abs(ut) GT 12 ) CASE i[0] EQ -1 OF 0: RETURN, ut 1: RETURN, Carrington( TimeSystem(ut,/silent) ) ENDCASE END ELSE: RETURN, Carrington( TimeSystem(/silent) ) ENDCASE END ENDCASE END