	FUNCTION TrimOVec, ntimes, usertime, oVec
;	---------------------------------------------------------------
;+							21-Aug-91
;	Name:
;		TrimOVec
;	PURPOSE:
;		Trim the observing log data-vectors according to the 
;		users entered start and stop times.
;	CALLING SEQUENCE:
;		newVec = TrimOVec( ntimes, usertime, oVec)
;	INPUT:
;		ntimes	number of times the user specified, generally 2.
;		userTim	user specified times in internal format
;		oVec 	observing log data vector to be trimed
;	RETURNED:
;		newOvec	the trimed observing log data-vector.
;	History:
;		written 21-Aug-91, by GAL
;-
;	--------------------------------------------------------------
;	ON_ERROR, 2	;force a return to caller on error

	ptrs = indgen(ntimes)	;data-vector pointers
	errs = indgen(ntimes)	;error value flags
	
	nOvec = N_Elements(oVec)

	FOR i=0, ntimes-1 DO BEGIN	;compute ptrs and errs values
	  IF (nOvec gt 1) THEN BEGIN
	    ptrs(i) = BinarySea(err, userTime(i), oVec.day, oVec.time)
	    errs(i) = err
	  ENDIF
	ENDFOR

;	Correct vector length if necessary:

	IF (nOvec NE 0) THEN BEGIN
	  IF ((errs(0) eq -1) and (errs(1) eq -1)) THEN BEGIN
	    IF (ptrs(0) eq ptrs(1)) THEN BEGIN
	      ret = 0		;all fid data outside of input times
	      print,'* No logical records found for input times'
	    ENDIF ELSE BEGIN
	      ret = oVec(ptrs(0):ptrs(1))	;define range
	    ENDELSE
	  ENDIF ELSE BEGIN	;no problem with range
	    ret = oVec(ptrs(0):ptrs(1))
	  ENDELSE
	ENDIF 	

	RETURN, ret
	END
