View Single Post
  #3  
Old May 7th 04, 06:16 PM
ydm9
external usenet poster
 
Posts: n/a
Default

Thanks for the replay.

I see you use a time of flight (we call that the elapsed time of the
flight). We calculate that by converting the depart and arrive local
times to GMT times. But, to get the correct GMT offset, you have to
know the correct date. To know the correct date, you need to know if
it is the depart date or the day after. If I can determine what date
to use to get the arrive station GMT offset, I'll have it made.


(Teacherjh) wrote in message ...

In order to get the correct GMT offset for the arrive station, I have
to know the correct date to use.


Just let your times go past 24:00 and less than 00:00. Then do a check, and
add or subtract a day based on the result. For example, starting with 23:00,
five hours of flight, and a +2 hour offset, you end up with 30:00 on (say)
Tuesday. Then you check to see if the time is 00:00 or =24:00. Since it's
+24:00, add a day and take away 24:00. So now we have 06:00 Wednesday.


Same idea, if you start out at 03:00 Friday, a two hour flight, and a seven
hour offset (the other way) (in the Space Shuttle, presumably!), you end up
with -06:00 (six hours below zero). We check to see if this is 00:00, and if
so, ADD 24:00 and subtract a day. We h ave 18:00 Thursday.

Limit checks like this are common for all date and time conversions (in fact,
any modulo arithmetic with carry). You'll need to check to see if the date
goes past Sunday (day 7) so it can cycle "back" to Monday (day 1), see if you
passed 31 or 30 or 29 or 28 (depending on month and year) so it can cycle back
to the first of Next Month, see if we passed December, etc.

Jose