;+
; NAME:
;     SRSP_TL_DECODE
; PURPOSE:
;     Decodes the time/label field of a record (the first 12 words of
;     each record, and returns a TLFIELD structure
; CATEGORY:
;     SRSP APC DATA-ANALYSIS
; CALLING SEQUENCE:
;     srsp_tl_struct = tl_decode(tldata)
; INPUTS:
;     tldata     an intarr(12) containing the first 12 words of a record,
;                  e.g. data(0:11), representing the time/label field
; OPTIONAL (KEYWORD) INPUT PARAMETERS:
; ROUTINES CALLED:
;     msec2str
; OUTPUTS:
;     tl_struct  an instance of a TLFIELD structure, filled in with the
;                  values from the time/label field data in tldata
; COMMENTS:
; SIDE EFFECTS:
; RESTRICTIONS:
; MODIFICATION HISTORY:
;     Written 13-May-2001 by Dale Gary
;-
function srsp_tl_decode,tldata

   tl_struct = get_srsp_tl_struct()

   tl_struct.nrc = tldata[1]
   tl_struct.scancode = tldata[0] and "377
   tl_struct.segmentcode = tldata[0]/256
   tl_struct.year = tldata[2]
   tl_struct.day = tldata[3]
   tl_struct.msec = w2l(tldata,4)
   tl_struct.yrday = string(tldata[2]+tldata[3]/1000.,format='(f8.3)')
   tl_struct.timstr = msec2str(tl_struct.msec)
   datarr = cvdoy(tldata[2],tldata[3])
   tl_struct.date = string(datarr,format='(I4,"/",I2.2,"/",I2.2)')
   tl_struct.weather = w2l(tldata,6)
   tl_struct.pa = w2l(tldata,8)

return,tl_struct
end

