Re: [fpc-pascal] convert "epoch" to UTC

2012-01-17 Thread Sven Barth
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

Re: [fpc-pascal] convert "epoch" to UTC

2012-01-16 Thread waldo kitty
On 1/16/2012 14:49, Sven Barth wrote: On 16.01.2012 20:06, waldo kitty wrote: with this TLE epoch number, 12013.93338171, ya feed it like so... var JEpoch : double; DT : TDateTime; [...] JEpoch := getJulianDay_SatEpoch(12,013.93338171); [...] if TryJulianDateToDateTime(JEpoch,DT) then writeln(

Re: [fpc-pascal] convert "epoch" to UTC

2012-01-16 Thread Mark Morgan Lloyd
waldo kitty wrote: Don't know whether any of this will help that actually looks very similar to some of my old TP/BP 6/7 time libraries that i created because there was not much available out there when i needed it... the one part that hit me the most was that the fractional days stuff is l

Re: [fpc-pascal] convert "epoch" to UTC

2012-01-16 Thread Sven Barth
On 16.01.2012 20:06, waldo kitty wrote: with this TLE epoch number, 12013.93338171, ya feed it like so... var JEpoch : double; DT : TDateTime; [...] JEpoch := getJulianDay_SatEpoch(12,013.93338171); [...] if TryJulianDateToDateTime(JEpoch,DT) then writeln(FormatDateTime(' MM DD hh:mm:ss',DT

Re: [fpc-pascal] convert "epoch" to UTC

2012-01-16 Thread waldo kitty
On 1/16/2012 13:38, Mark Morgan Lloyd wrote: waldo kitty wrote: i think i might be able to do something with the JulianToDateTime once i get the base year portion converted to a true julian... i spotted some C# code while doing a bit of research earlier (see below)... it appears to convert the

Re: [fpc-pascal] convert "epoch" to UTC

2012-01-16 Thread waldo kitty
On 1/16/2012 12:54, Ralf A. Quint wrote: At 09:40 AM 1/16/2012, Sven Barth wrote: Well... I would say the same as FPC's "floor" routine ( http://www.freepascal.org/docs-html/rtl/math/floor.html ) does ;) Well... someone might want to check the example for that function ;) +1 especially sinc

Re: [fpc-pascal] convert "epoch" to UTC

2012-01-16 Thread waldo kitty
On 1/16/2012 12:40, Sven Barth wrote: On 16.01.2012 17:57, waldo kitty wrote: [TRIM] looks like it should be easy to convert to pascal, too ;) just gotta find out what that "floor" routine does ;) Well... I would say the same as FPC's "floor" routine ( http://www.freepascal.org/docs-html/rtl/

Re: [fpc-pascal] convert "epoch" to UTC

2012-01-16 Thread Mark Morgan Lloyd
waldo kitty wrote: i think i might be able to do something with the JulianToDateTime once i get the base year portion converted to a true julian... i spotted some C# code while doing a bit of research earlier (see below)... it appears to convert the year to a julian year and then add the decim

Re: [fpc-pascal] convert "epoch" to UTC

2012-01-16 Thread Ralf A. Quint
At 09:40 AM 1/16/2012, Sven Barth wrote: Well... I would say the same as FPC's "floor" routine ( http://www.freepascal.org/docs-html/rtl/math/floor.html ) does ;) Well... someone might want to check the example for that function ;) Ralf ___ fpc-pa

Re: [fpc-pascal] convert "epoch" to UTC

2012-01-16 Thread Sven Barth
On 16.01.2012 17:57, waldo kitty wrote: Especially you can try JulianToDateTime and UnixToDateTime. Both return a TDateTime which you can convert to a string using FormatDateTime ( http://www.freepascal.org/docs-html/rtl/sysutils/datetimetostring.html ) or DateTimeToStr ( http://www.freepascal.or

Re: [fpc-pascal] convert "epoch" to UTC (waldo kitty)

2012-01-16 Thread waldo kitty
On 1/16/2012 09:44, edgar jordan wrote: 12 == 2012 013 == 13th day of the year .9338171 * 24 == 22.4116104 hours i typoed the above... it should be .93338171 * 24 == 22.40116104 hours .4114104 * 60 == 24.696624 minutes so this becomes .40116104 * 60 == 24.0696624 minutes which then leads

Re: [fpc-pascal] convert "epoch" to UTC

2012-01-16 Thread waldo kitty
On 1/16/2012 06:22, Sven Barth wrote: Am 16.01.2012 04:10 schrieb "waldo kitty" > > > i'm needing to convert a "UTC epoch" date to a "standard time string"... by > that, i mean that i want to get something like "2011-01-13 22:24:04" out of > the "epoch" number 12013.9338171... TYPO ALERT!

[fpc-pascal] convert "epoch" to UTC (waldo kitty)

2012-01-16 Thread edgar jordan
12 == 2012 013 == 13th day of the year .9338171 * 24 == 22.4116104 hours .4114104 * 60 == 24.696624 minutes The decimal portion of hours doesn't match the one multiplied by 60. I just thought it's the one causing the discrepancy. ___ fpc-pascal maillist

Re: [fpc-pascal] convert "epoch" to UTC

2012-01-16 Thread Sven Barth
Am 16.01.2012 04:10 schrieb "waldo kitty" : > > > i'm needing to convert a "UTC epoch" date to a "standard time string"... by that, i mean that i want to get something like "2011-01-13 22:24:04" out of the "epoch" number 12013.9338171... > > the above "epoch" number is (supposedly) built like this.

[fpc-pascal] convert "epoch" to UTC

2012-01-15 Thread waldo kitty
i'm needing to convert a "UTC epoch" date to a "standard time string"... by that, i mean that i want to get something like "2011-01-13 22:24:04" out of the "epoch" number 12013.9338171... the above "epoch" number is (supposedly) built like this... 12 == 2012 013 == 13th day of the year .9338