static private Method

Time.make_time(year, mon, day, hour, min, sec, sec_fraction, zone, now)

There's no documentation for this item.

Source Code

# File time.rb, line 151
def make_time(year, mon, day, hour, min, sec, sec_fraction, zone, now)
  usec = nil
  usec = (sec_fraction * 1000000).to_i if sec_fraction
  if now
    begin
      break if year; year = now.year
      break if mon; mon = now.mon
      break if day; day = now.day
      break if hour; hour = now.hour
      break if min; min = now.min
      break if sec; sec = now.sec
      break if sec_fraction; usec = now.tv_usec
    end until true
  end

  year ||= 1970
  mon ||= 1
  day ||= 1
  hour ||= 0
  min ||= 0
  sec ||= 0
  usec ||= 0

  off = nil
  off = zone_offset(zone, year) if zone

  if off
    year, mon, day, hour, min, sec =
      apply_offset(year, mon, day, hour, min, sec, off)
    t = Time.utc(year, mon, day, hour, min, sec, usec)
    t.localtime if !zone_utc?(zone)
    t
  else
    self.local(year, mon, day, hour, min, sec, usec)
  end
end
Comments

Have your say
Please use Textile formatting (click here for a cheat sheet). Use <code/> and <pre/> for code samples.
Click here to login with OpenID to to post comments.