Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

Almost 1 second extra in time subtraction (rails 2.3.4)

#3212

Previously, in rails 2.3.3 and earlier:

1.day.ago.end_of_day - 1.day.ago.beginning_of_day => 86399.0

However, with rails 2.3.4:

1.day.ago.end_of_day - 1.day.ago.beginning_of_day => 86399.9999990463

I believe that the old behavior is much more correct. The new behavior almost adds 1 whole second.

Reported by Mina Naguib · September 15th, 2009 @ 09:00 PM

State: invalid
Milestone: none
Assigned to: nobody
Importance: none

Activity

  1. CancelProfileIsBroken
    CancelProfileIsBroken
    • Tag changed from 2.3.4, float, time, timewithzone to 2.3.4, bugmash, float, time, timewithzone

    September 25th, 2009 @ 12:07 PM

  2. John Guenin
    John Guenin

    -1 Rails 2.3.4 adds usec to Time#end_of_day. The new value is actually more accurate.

    # Rails 2.3.4
    def end_of_day
      change(:hour => 23, :min => 59, :sec => 59, :usec => 999999.999)
    end
    
    # Rails 2.3.3
    def end_of_day
      change(:hour => 23, :min => 59, :sec => 59)
    end
    

    September 26th, 2009 @ 09:39 PM

  3. Blue Box Chris
    Blue Box Chris
    1. Rails 2.3.4 is more accurate

    @@@ Ruby

    Rails 2.0.5

    def end_of_day

    change(:hour => 23, :min => 59, :sec => 59)
    

    end

    
    

    September 26th, 2009 @ 10:20 PM

  4. Blue Box Chris
    Blue Box Chris

    Pardon my terrible formatting above. The intent was.

    -1 Rails 2.3.4 is more accurate

    Rails 2.0.5
    def end_of_day

    change(:hour => 23, :min => 59, :sec => 59)
    

    end

    September 26th, 2009 @ 10:22 PM

  5. Robert Rouse
    Robert Rouse

    -1 for the feature.

    I agree with John and Chris

    September 26th, 2009 @ 10:30 PM

  6. Elad Meidar
    Elad Meidar
    • Tag changed from 2.3.4, bugmash, float, time, timewithzone to 2.3.4, bugmash, bugmash-review, float, time, timewithzone

    Yap, seems like the initial approach was the wrong one.
    -1 on feature, i think this one should be closed too.

    September 27th, 2009 @ 12:58 AM

  7. Matías Flores
    Matías Flores

    -1 The new behavior is more accurate. Actually almost a whole second was missing in 2.3.3 and below.

    September 27th, 2009 @ 02:51 AM

  8. John Pignata
    John Pignata

    -1 - the new behavior is desirable.

    September 27th, 2009 @ 03:22 AM

  9. sr.iniv.t
    sr.iniv.t

    I'm with John and Chris on end_of_day computation.

    September 27th, 2009 @ 05:43 AM

  10. Kieran P
    Kieran P

    -1 In 2.3.4, you are fractionally closer to the end of the day, which is more accurate than 2.3.3.

    September 27th, 2009 @ 07:01 AM

  11. MOROHASHI Kyosuke
    MOROHASHI Kyosuke

    -1 I feel new behavior more reasonable, too.

    September 27th, 2009 @ 09:27 AM

  12. CancelProfileIsBroken
    CancelProfileIsBroken
    • State changed from new to invalid
    • Tag changed from 2.3.4, bugmash, bugmash-review, float, time, timewithzone to 2.3.4, float, time, timewithzone

    The masses have spoken.

    September 27th, 2009 @ 12:05 PM