Class: Time

Inherits:
Object
  • Object
show all
Defined in:
lib/time_extentions.rb

Instance Method Summary collapse

Instance Method Details

#to_a_datetimeObject



7
8
9
10
11
12
13
14
# File 'lib/time_extentions.rb', line 7

def to_a_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