Skip to content

Commit

Permalink
Fix allocating a Time subclass in Time#at when passed a Time object
Browse files Browse the repository at this point in the history
Fixes #1113
  • Loading branch information
dbussink committed Aug 11, 2011
1 parent 724bf3d commit ccda7db
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion kernel/common/time.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ class Time
}

def self.at(sec, usec=nil)
return sec.dup if sec.kind_of? Time
if sec.kind_of? Time
return specific(sec.to_i, sec.usec, sec.gmt?)
end

if sec.kind_of?(Integer) || usec
sec = Rubinius::Type.coerce_to sec, Integer, :to_i
Expand Down

0 comments on commit ccda7db

Please sign in to comment.