method

delta_to_dhms

Importance_0
Ruby latest stable (v2_5_5) - 0 notes - Class: Delta

Method deprecated or moved

This method is deprecated or moved on the latest stable version. The last existing version (v1_9_2_180) is shown here.

delta_to_dhms(delta) public

No documentation

This method has no description. You can help the Ruby community by adding new notes.

Hide source
# File lib/date/delta.rb, line 111
    def self.delta_to_dhms(delta)
      fr = delta.imag.abs
      y,   fr = fr.divmod(12)
      m,   fr = fr.divmod(1)

      if delta.imag < 0
        y = -y
        m = -m
      end

      fr = delta.real.abs
      ss,  fr = fr.divmod(SECONDS_IN_DAY) # 4p
      d,   ss = ss.divmod(86400)
      h,   ss = ss.divmod(3600)
      min, s  = ss.divmod(60)

      if delta.real < 0
        d = -d
        h = -h
        min = -min
        s = -s
      end

      return y, m, d, h, min, s, fr
    end
Register or log in to add new notes.