;                    DPS_TIM2REC
;+
;  Code to translate a time interval into a data point range applicable
;  to the dp_sync data.
;
;  Output products:
;            SS array contains all data numbers in time interval
;            TTIME contains time (hours) of all data in interval
;            DS_ST & DS_END contain start and stop data point numbers.
;
;
;  Use:   idl> .run dps_tim2rec            and give time interval in hours.
;
;-
ttime = dp_sync.time +(dp_sync.day - dp_sync(0).day)*86400L*1000L
ttime = ttime/3600./1000. 

print,'Time range of data file is - ',ttime(0),$ 
      ' to',ttime(n_elements(ttime)-1),' hrs UT',format='(a,f5.2,a,f5.2,a)'

print,' '
print,' Give start and stop times in decimal hours.'
read,start,stop
qt = [start,stop]
ss = where( (ttime ge qt(0)) and (ttime le qt(1)) )
if n_elements(ss) ge 2 then begin
   print,' '
   print, 'All the corresponding data point numbers are now in array SS.'
   print, 'First and last datasets are ',ss(0),' and ',ss(n_elements(ss)-1)
   print,' and these are in variables DS_ST & DS_END.'
   print,' TTIME now contains the times of the dp_sync data in hours UT.'
   ds_st  = ss(0)
   ds_end = ss(n_elements(ss)-1)
endif else begin
   print,'No datasets found in that time range.'
   ds_st  = 0
   ds_end = 0
   ss = 0
endelse
   
end
