Todd Benson wrote:
> Output your dstStart and dstEnd values while you run the program
> (inside the "if" construct).  That should give you some idea.  I don't
> think this is a bug in the new_offset method, but who knows?  You said
> "some" events.  Is it always at the same time of day?  A certain time
> of year?


Todd:

Thanks for your reply.
dstStart and dstEnd are class variables, and are constants representing 
the UT of DST start and end for the United States for 2008. All of my 
astronomical data are in UT, so that works out for me.

I have a container object, day, that utilizes an array to wrangle my 
event objects. The array has three event objects in it:
0 - rise
1 - transit
2 - set

It's only the rise object for this invocation of the day class that 
fails, and only for DST times.

In addition, the code works well for another very simmilar application.

Referring to (and expanding a bit on) my original post (snipped from the 
event class' code):

offset = Rational(-7,24)
if (@jd > @@dstStart) && (@jd < @@dstEnd)
   offset = Rational(-6,24)
end
@ld = @jd.new_offset(offset)

@jd.to_s #=> 2008-03-09T13:24:59+00:00
@ld.to_s #=> 2008-03-09T06:24:59-06:00
                                ^^^^^^
                                !!!!!!

It's my understanding that 13:24:59 offset by -6 hours should result in 
7:24:59, not 6:24:59. The @ld instance seems to be confused?

But, these seem to be ok:

offset = Rational(-7,24)
if (@jd > @@dstStart) && (@jd < @@dstEnd)
   offset = Rational(-5,24) # Changed for debugging
end
@ld = @jd.new_offset(offset)

@jd.to_s #=> 2008-03-09T13:24:59+00:00
@ld.to_s #=> 2008-03-09T08:24:59-05:00 - Correct



offset = Rational(-7,24)
if (@jd > @@dstStart) && (@jd < @@dstEnd)
   offset = Rational(-8,24) # Changed for debugging
end
@ld = @jd.new_offset(offset)

@jd.to_s #=> 2008-03-09T13:24:59+00:00
@ld.to_s #=> 2008-03-09T05:24:59-08:00 - Correct

Sorry about the lack of actual code -- I don't want to post my pile of 
noobish fugly code, unless I have to ;) -- but I will if it's helpful.

Thanks!
Greg
-- 
Posted via http://www.ruby-forum.com/.