Method: RiCal::FastDateTime#seconds_to_hms

Defined in:
lib/ri_cal/fast_date_time.rb

#seconds_to_hms(total_seconds) ⇒ Object



119
120
121
122
123
124
125
126
# File 'lib/ri_cal/fast_date_time.rb', line 119

def seconds_to_hms(total_seconds)
  sign = total_seconds <=> 0
  remaining = total_seconds.abs
  seconds = sign * (remaining % 60)
  remaining = remaining / 60
  minutes = sign * (remaining % 60)
  [remaining / 60, minutes, seconds]
end