;+
; NAME:
;	BCS_DP_CHECK
; PURPOSE:
;	check that DP_SYNC and BCS times overlap
; CALLING SEQUENCE:
;	OK=BCS_DP_CHECK(DP_SYNC,BDA_INDEX)
; INPUTS:
;       DP_SYNC      - DP_SYNC structure
;       BDA_INDEX    - BDA index structure
; OUTPUTS:
;       OK           - 1 if overlap, 0 otherwise
; PROCEDURE:
;                      simple check on min and max times
; HISTORY:
;                      Written Apr'93 (DMZ, ARC)
;-

 function bcs_dp_check,dp_sync,bda_index

 if (datatype(dp_sync) ne 'STC') or (datatype(bda_index) ne 'STC') then begin
  message,'invalid inputs',/contin
  return,0
 endif

 msec_day=24l*3600L*1000L
 bda_day=gt_day(bda_index)
 bda_stime=gt_time(bda_index)+msec_day*(bda_day-bda_day(0))
 dp_day=gt_day(dp_sync)
 dp_time=gt_time(dp_sync)+msec_day*(dp_day-dp_day(0))
 min_dp=min(dp_time)
 max_dp=max(dp_time)
 max_bda=max(bda_stime)
 min_bda=min(bda_stime)
 return,(min_dp le max_bda) and (max_dp ge min_bda)

 end
