Viewing contents of file '../idllib/astron/contrib/varosi/vlib/allpro/conv_ascii_time.pro'
;+
; NAME:
;	conv_ascii_time
; PURPOSE:
;	Convert time strings of form 'hh:mm:ss' into seconds (32-bit).
; CALLING:
;	seconds = conv_ascii_time( times, dates )
; INPUTS:
;	time_strings = string array in form  "hh:mm:ss".
;	date_strings = string array in form  "mm/dd/yy"  or  "dd-mmm-yy"
; LIMITATIONS:
;	If dates have different month or year the relative times will be wrong.
; OUTPUTS:
;	Function results is seconds relative to begining of month.
; HISTORY:
;	Written, Frank Varosi NASA/GSFC 1991.
;-

function conv_ascii_time, time_strings, date_strings

	h = strmid( time_strings, 0, 2 )
	m = strmid( time_strings, 3, 2 )
	s = strmid( time_strings, 6, 2 )
	seconds = h*3600L + m*60 + s

	Nday = N_elements( date_strings )
	if Nday NE N_elements( time_strings ) then return, seconds

	ws = where( strpos( date_strings, "/" ) GT 0, ns )
	wd = where( strpos( date_strings, "-" ) GT 0, nd )
	wb = where( strpos( date_strings, " " ) GT 0, nb )

	if (ns + nd + nb) NE Nday then begin
		message,"some unknown type of date strings",/INFO
		return, seconds
	   endif

	day = intarr( Nday )

	if (ns GT 0) then  day(ws) = fix( strmid( date_strings(ws), 3, 2 ) )
	if (nd GT 0) then  day(wd) = fix( strmid( date_strings(wd), 0, 2 ) )
	if (nb GT 0) then  day(wb) = fix( strmid( date_strings(wb), 4, 2 ) )

return, seconds	+ day * 24 * 3600L
end