I'm not sure I understand what you are trying to do. Are you trying  
to work out a time-zone by using longitude? Surely not...

Cheers,
Bob

On Aug 8, 2006, at 6:42 PM, Ara.T.Howard wrote:

> On Tue, 8 Aug 2006, Tim Pease wrote:
>
>> That does make sense.  Here's what I came up with based on that ...
>>
>> class Time
>>
>> OFFSETS = class << self; ZoneOffset end
>> ZONES = OFFSETS.keys.select {|z| z.length == 1}.sort
>> ZONES.unshift ZONES.pop
>>
>> def translate longitude
>>   zone = ZONES[Integer(longitude) / 15]
>>   t = utc - ::Time.zone_offset(zone)
>>
>>   unless zone == 'Z'
>>     zone = OFFSETS[zone]
>>     str = t.iso8601
>>
>>     str.sub! %r/Z$/, ''
>>     str << (zone > 0 ? '-' : '+')
>>     str << "%02d:00" % zone.abs
>>
>>     t = Time.iso8601 str
>>   end
>>
>>   return t
>> end
>> end
>>
>>
>> I had to go through and intermediary string in order to get into the
>> right timezone.  Printing out the returned Time object says it is
>> still in UTC, but that doesn't matter.  It's in the correct timezone
>> for your parsing needs.
>>
>> If that doesn't work or is not what you want, just shot me a private
>> e-mail with your work number and I'll cal you
>
> too funny.  this is a sketch of my code so far:
>
>
>     off_sec =
>       if longitude > 180.0
>         ((360.0 - longitude) / DEG_PER_HR) * SECS_PER_HR
>       else
>         (longitude / DEG_PER_HR) * SECS_PER_HR
>       end
>
>     signedness = off_sec > 0 ? +1 : -1
>     sign = signedness > 0 ? '+' : '-'
>
>     hour_offset, r = off_sec.to_i.abs.divmod SECS_PER_HR
>     min_offset, r = r.divmod SECS_PER_MIN
>
>     hour_offset *= signedness
>
>     zone = '%s%-02.2d:%-02.2d' % [sign, hour_offset.to_i,  
> min_offset.to_i.abs]
>
>     utc_plus_off = time + off_sec
>
>     localtime_expressed_in_utc = Time.parse(utc_plus_off.sub(%r/Z 
> $/, zone)).utc
>
>
> look familiar ;-)
>
> yeah - this will do it - the time is expressed in utc but at least  
> it's the
> actual correct time with respect the ground sampled by the bird at  
> that moment.
>
> thanks for the help - the fact that you came up with that  
> independently makes
> me feel better.
>
> -a
> -- 
> to foster inner awareness, introspection, and reasoning is more  
> efficient than
> meditation and prayer.
> - h.h. the 14th dali lama
>

----
Bob Hutchison                  -- blogs at <http://www.recursive.ca/ 
hutch/>
Recursive Design Inc.          -- <http://www.recursive.ca/>
Raconteur                      -- <http://www.raconteur.info/>
xampl for Ruby                 -- <http://rubyforge.org/projects/xampl/>