pro cp_cattime, time=time, cp=cp, cas=cas

   ; Check syntax and get in seconds for boundary check

   at = anytim(time, /utime, error=error)

   if cas eq 0 then begin   ; check start time against CP time boundaries

      if error eq 0 then begin    ; no syntax error

        ; check if user's time is within bounds.
    if at ge cp.minutime then cp.stime = strmid(anytim(time, /atime),0,15) $
    else begin
        print,'Start time is prior to first catalog time...correcting.'
        cp.stime = cp.mintime
        return  
    endelse

    if at le cp.maxutime then cp.stime = strmid(anytim(time, /atime),0,15) $
    else begin
        print,'Start time is after last catalog time...correcting.'
        cp.stime = cp.maxtime  
    endelse

      endif else print,'Syntax error in start time, time ignored.' 

   endif else begin             ; check end time against CP time boundaries

      if error eq 0 then begin    ; no syntax error
        ; check if user's time is too early

    if at ge cp.minutime then cp.etime = strmid(anytim(time, /atime),0,15) $
    else begin
        print,'End time is prior to first catalog time...correcting.'
        cp.etime = cp.mintime  
        return
    endelse

    if at le cp.maxutime then cp.etime = strmid(anytim(time, /atime),0,15) $
    else begin
        print,'End time is after last catalog time...correcting.'
        cp.etime = cp.maxtime  
    endelse

      endif else print,'Syntax error in end time, time ignored.' 

   endelse

return
end