FUNCTION CHECK_SL_PHASE, in_time
;+
; return the stray light phase number from time string or XRT index
;     IDL> num=check_sl_phase('1-jan-2016')
;     IDL> num=check_sl_phase(index)
;     IDL> print,check_sl_phase()    ; list of phase definition
;-
p=-1
if n_params() eq 0 then begin
   print, '--- phase 0 : 23-Oct-2006 10:00'
   print, '--- phase 1 :  9-May-2012 12:00'
   print, '--- phase 2 : 14-Jun-2015 12:30'
   print, '--- phase 3 : 27-May-2017 11:00'
   print, '--- phase 4 : 29-May-2018 00:00'
   print, '--- phase 5 :  8-Jun-2022 12:40'
   print, '--- phase 6 :  5-May-2023 04:30'
   print, '--- phase 7 : 11-May-2024 06:15'
   goto, FIN
endif
;
p=0
tim_p1_st=' 9-May-2012 12:00' & p1_sec=anytim(tim_p1_st,/sec)
tim_p2_st='14-Jun-2015 12:30' & p2_sec=anytim(tim_p2_st,/sec)
tim_p3_st='27-May-2017 11:00' & p3_sec=anytim(tim_p3_st,/sec)
tim_p4_st='29-May-2018 00:00' & p4_sec=anytim(tim_p4_st,/sec)
tim_p5_st=' 8-Jun-2022 12:40' & p5_sec=anytim(tim_p5_st,/sec)
tim_p6_st=' 5-May-2023 04:30' & p6_sec=anytim(tim_p6_st,/sec)
tim_p7_st='11-May-2024 06:15' & p7_sec=anytim(tim_p7_st,/sec)
;
typ=size(in_time,/typ)
if typ eq 8 then intime_sec=anytim(in_time.date_obs,/sec) $
            else intime_sec=anytim(in_time,/sec)
;
;print,p1_sec,p2_sec,p3_sec,p4_sec
;print,intime_sec
;
if intime_sec ge p1_sec then p=1
if intime_sec ge p2_sec then p=2
if intime_sec ge p3_sec then p=3
if intime_sec ge p4_sec then p=4
if intime_sec ge p5_sec then p=5
if intime_sec ge p6_sec then p=6
if intime_sec ge p7_sec then p=7
;
FIN:
return,p
end
