      subroutine timeseries_offset
      
      include 'CASCO.DIM'
      include 'wind.h'
      include 'sacotime.h'
      real toffset_hours
      toffset_hours= 24.*real(kd_saco(1)-w_kd)
     &              +(sec_saco(1)-w_secs)/3600.
      
      offset=floor(toffset_hours/(w_delt/3600.))
      write(*,*) 
      write(*,*) 
      write(*,*) 
      write(*,*) 'XXXXXXXXXXXX-OFFSET-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
      write(*,*) 'Saco Time Begins at:',kd_saco(1),sec_saco(1)
      write(*,*) 'Time Series Begins at:',w_kd,w_sec
      write(*,*) 'timeseries offset by ',toffset_hours,'hours.'
      write(*,*) 'Wind is offset by', offset,' boundary condition'
     &' time steps.'

      if (offset.lt.nlags) write(*,*)'Time series does not start early',
     & 'enough! nlags=',nlags,' offset=',offset
       
      write(*,*) 'XXXXXXXXXXXX-OFFSET-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
      write(*,*) 
      write(*,*) 
      return
      end
