class Time
Extend Time
to allow conversion to DateTime instances
Public Instance Methods
to_datetime()
click to toggle source
Convert to a DateTime instance stackoverflow.com/a/279785/123695 @return [DateTime]
# File lib/nose/util.rb, line 323 def to_datetime # Convert seconds + microseconds into a fractional number of seconds seconds = sec + Rational(usec, 10**6) # Convert a UTC offset measured in minutes to one measured in a # fraction of a day. offset = Rational(utc_offset, 60 * 60 * 24) DateTime.new(year, month, day, hour, min, seconds, offset) end