cal_jul.lua


NAME
    cal_jul

FUNCTION
    cal_jul(yy, mm, dd, hh, mi, ss)
    jul_cal(jul)

NOTES
    Conversion between calender date and Julian date number.

SOURCE

require("register")

function cal_jul(yy, mm, dd, hh, mi, ss)
    return zeMath.cal2jul(yy, mm, dd) +
           hh/24 + mi/1440 + ss/86400
end

function jul_cal(jul)
    local yy, mm, dd = zeMath.jul2cal(jul)
    jul = (jul - math.floor(jul)) * 24
    local hh = math.floor(jul)
    jul = (jul - hh) * 60
    local mi = math.floor(jul)
    local ss = math.floor((jul - mi) * 60 + 1.e-5)
    return yy, mm, dd, hh, mi, ss
end