On Jan 7, 2008 3:05 PM, Greg Go <ruby-forum / incognitology.com> wrote: > 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. And only with Rational(-6, 24) during the rise event? > > 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) Try (#'s mark the additional/changed lines)... offset = Rational(-7, 24) puts "dstStart before IF: " << @@dstStart ### puts "dstEnd before IF: " << @@dstEnd ### if (@jd > @@dstStart) && (@jd < @@dstEnd) puts "dstStart after IF: " << @@dstStart ### puts "dstEnd after IF: " << @@dstEnd ### offset = Rational(-6, 24) end @ld = @jd.new_offset(offset) puts @jd ### puts @ld ### and see what you get for the rise event (just out of curiosity). Todd