Computing The Time Elements (hh, mm, ss)
There are slightly different procedures for computing the time elements (
hh,mm,ss ) depending on the starting argument and the type of time we are computing. e.g. is it an actual time of day or a fraction of a day converted into equivalent time elements.
All times used here will be expressed in the universal standard 00 h to 24 h format.
There are three basic sources of fractions that will be converted into time elements.
Algorithm 2a:
Given any general JD number, compute the time elements ( hh,mm,ss ) from its decimal part. These time elements are will all equate to integer values with the seconds value (ss ) roundedoff to the nearest second.
uu = JD + 0.5 hours = 24*(uu  floor(uu)) hh = floor(hours) minutes = 60*(hours  hh) mm = floor(minutes) seconds = 60*(minutes  mm) ss = floor(seconds + 0.5) RANDOM EXAMPLE 1: Given: JD = $RandJD
To find the time of day elements ( hh,mm,ss ) from the decimal part of any general JD number:
JD = $RandJD uu = JD + 0.5 = $x1uu hours = 24*(uu  floor(uu)) = $x1hours hh = floor(hours) = $x1hh minutes = 60*(hours  hh) = $x1ww mm = floor(minutes) = $x1mm seconds = 60*(minutes  mm) = $x1seconds ss = floor(seconds + 0.5) = $x1ssSo the time of day elements, in this case, work out to: hh:mm:ss = $x1hh:$x1mm:$x1ss = $x1hhh $x1mmm $x1sss resolved to the nearest second.
Algorithm 2b:
Given a (± DayFrac ) value, compute the corresponding time elements (TimeSignVal, hh, mm, ss )
if DayFrac < 0 then TimeSignVal = 1 else TimeSignVal = 1 hours = TimeSignVal * 24 * DayFrac hh = floor(hours) minutes = 60*(hours  hh) mm = floor(minutes) seconds = 60*(minutes  mm) ss = floor(seconds + 0.5)or TimeSignVal = (DayFrac < 0)? 1:1 hours = TimeSignVal * 24 * DayFrac hh = floor(hours) minutes = 60*(hours  hh) mm = floor(minutes) seconds = 60*(minutes  mm) ss = floor(seconds + 0.5) RANDOM EXAMPLE 2: Given: DayFrac = $x2RandDayFrac
To find the time elements ( TimeSignVal, hh,mm,ss ) corresponding to day fraction (±DayFrac ):
TimeSignVal = (DayFrac < 0)? 1:1 = 1 hours = TimeSignVal * 24 * DayFrac = $x2hours hh = floor(hours) = $x2hh minutes = 60*(hours  hh) = $x2ww mm = floor(minutes) = $x2mm seconds = 60*(minutes  mm) = $x2seconds ss = floor(seconds + 0.5) = $x2ssSo the time elements corresponding to the fraction of a day, in this case, work out to: hh:mm:ss = $x2hh:$x2mm:$x2ss = $x2hhh $x2mmm $x2sss resolved to the nearest second.
Algorithm 2c:
Given an ( ±hours ) value, compute the corresponding time elements (TimeSignVal, hh,mm,ss ).
if hours < 0 then TimeSignVal = 1 else TimeSignVal = 1 uu = TimeSignVal * hours hh = floor(uu) ww = 60*(uu  hh) mm = floor(ww) ss = 60*(ww  mm)or TimeSignVal = (hours < 0)? 1:1 uu = TimeSignVal * hours hh = floor(uu) ww = 60*(uu  hh) mm = floor(ww) ss = 60*(ww  mm) RANDOM EXAMPLE 3: Given: hours = $x3RandHours
To find the time elements ( hh,mm,ss ) corresponding to the decimal (hours ) value:
TimeSign = ($x3RandHours < 0)? 1:1 = 1 hours = $x3RandHours hh = floor(hours) = $x3hh ww = 60*(hours  hh) = $x3ww mm = floor(ww) = $x3mm ss = 60*(ww  mm) = $x3ssSo the time elements, corresponding to the hours value, in this case, work out to: hh:mm:ss = $x3hh:$x3mm:$x3ss = $x3hhh $x3mmm $x3sss resolved to the nearest millisecond. © Jay Tanner  $cYear
