class Time

Public Instance Methods

ceil(ndigits = 0) click to toggle source
# File lib/backports/2.7.0/time/ceil.rb, line 3
def ceil(ndigits = 0)
  # Imitate value.ceil(ndigits) which does not exist in Ruby < 2.4
  sceil = (subsec * 10**ndigits).ceil.to_r / 10**ndigits
  change = sceil - subsec
  self + change
end
floor(ndigits = 0) click to toggle source
# File lib/backports/2.7.0/time/floor.rb, line 3
def floor(ndigits = 0)
  self - subsec.modulo(10**-ndigits)
end