A
ara.t.howard
i'm working on a sticky issue: i'm converting some times based on a utc time
and longitude - the goal is the express the time as solar local time.
the code i have is close. it does something like:
DEG_PER_HR = 15.0
SECS_PER_MIN = 60.0
SECS_PER_HR = SECS_PER_MIN * 60.0
SECS_PER_DAY = SECS_PER_HR * 24
# longitudes > 180 degrees are behind UT
# longitudes <= 180 degrees are ahead of UT
offset_seconds =
if longitude > 180.0
- ((360.0 - longitude) / DEG_PER_HR) * SECS_PER_HR
else
(longitude / DEG_PER_HR) * SECS_PER_HR
end
utc + offset_seconds
this in fact yields the correct time __except__ that's it's expressed in zulu
time and not the 'local' time zone. the trick is that 'local' here means
'there' not 'here'! ;-) in otherwords it needs to be expressed in the local
time zone of that __longitude__ not mine and not that of greenwich.
to put it more consisely i need to be able to follow
locatime_but_in_utc = utc + offset_seconds
with
move_to_zone locatime_but_in_utc, longitude
or some other viable alternative.
thoughts?
-a
and longitude - the goal is the express the time as solar local time.
the code i have is close. it does something like:
DEG_PER_HR = 15.0
SECS_PER_MIN = 60.0
SECS_PER_HR = SECS_PER_MIN * 60.0
SECS_PER_DAY = SECS_PER_HR * 24
# longitudes > 180 degrees are behind UT
# longitudes <= 180 degrees are ahead of UT
offset_seconds =
if longitude > 180.0
- ((360.0 - longitude) / DEG_PER_HR) * SECS_PER_HR
else
(longitude / DEG_PER_HR) * SECS_PER_HR
end
utc + offset_seconds
this in fact yields the correct time __except__ that's it's expressed in zulu
time and not the 'local' time zone. the trick is that 'local' here means
'there' not 'here'! ;-) in otherwords it needs to be expressed in the local
time zone of that __longitude__ not mine and not that of greenwich.
to put it more consisely i need to be able to follow
locatime_but_in_utc = utc + offset_seconds
with
move_to_zone locatime_but_in_utc, longitude
or some other viable alternative.
thoughts?
-a