Am 16.01.2012 23:57, schrieb waldo kitty:
anyway, the format is like this...
*_TLE Epoch Format_*
eg: 12013.93338171
1. there are always 5 digits to the left of the decimal. the first two
digits
are the year of the epoch.
if year<57 then year:=year+2000 else year:=year+1900
in the above, 12 is the year which is 2012.
2. the next three digits (up to the decimal point) are the "day number
of the
year" of the TLE Epoch record.
in the above, 013 is the day number of the year. feed this plus the year
to a julian date routine to find the julian date number. in this example,
we're looking for the julian date number for the 13th day of 2012.
3. the digits from the decimal point to the end are the fractional part of
the day. these are /not/ in julian date or julian day format.
in the above, .93338171 is the fractional part of the day. the time portion
of the formula goes like this.
fooo := frac(12013.93338171)
rslt := fooo * 24 // 22.40116104
hour := trunc(rslt) // 22
fooo := frac(rslt) // .40116104
rslt := fooo * 60 // 24.0696624
mins := trunc(rslt) // 24
fooo := frac(rslt) // .0696624
rslt := fooo * 60 // 4.179744
secs := trunc(rslt) // 4
fooo := frac(rslt) // .179744
rslt := fooo * 1000 // the more zeros, the more precision
msec := trunc(rslt) // 179
4. convert the julian date number from #2 to TDateTime. fill in the
TDateTime
time fields from #3. now EncodeDateTime and you'll have the proper numbers
in a TDateTime record.
so what i ran into, besides the julian date routines not doing the time,
but i was also sending the entire decimal number, without the year
digits, to the julian date routine and that was just flat wrong since
the fractional side wasn't a julian date fraction! ::TripleFacePalm::
so there's three pieces of data stored in that one "TLE Epoch" number
and each has to be broken out and treated differently... now my answers
finally agree with the programs i've been attempting to verify them
against... i just couldn't see the forest for the trees and couldn't see
the trees for all the leaves on'em :LOL:
Have you tried just adding the fractional part (which you called "fooo"
above) to the TDateTime value returned by TryJulianToDateTime and then
feeding that to FormatDatTime? It should give you the same result... (at
least I hope that ^^)
Regards,
Sven
_______________________________________________
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal