;+
; NAME:
;  sprl_cvt_jtime_tod - converts the fractional part of a Julian date to time
;
function sprl_cvt_jtime_tod, nJD, seconds=seconds
;
; ARGUMENTS:
;  nJD  the Julian Date or Dates to convert.
;
; KEYWORDS:
;  /seconds   when present returns a vector of seconds
;             when absent returns an array with hours,
;               minutes and seconds
; RETURNS
;  A vector of seconds or an array of hours minutes and seconds
;                 with [*,0] containing the hours
;                      [*,1] containing the minutes
;                      [*,2] containing the seconds
;
;
; CHANGES:
;  7-Jun-2005  D. Gell Initial Coding
;
;-
;---------------------------------------------------------------------
    nTod = ulong((nJD - floor(nJD)) * 86400.) 

    nTod = (nTod + 43200) mod 86400
    if keyword_set(seconds) then return, nTod

    nHr  = nTod / 3600L
    nRem = nTod - nHr * 3600L
    nMin = nRem / 60L
    nSec = nRem - nMin * 60L

    return, reform([[nHr], [nMin], [nSec]])
  end
