Module: OpeningHours::TimeUtils
- Defined in:
- lib/opening_hours.rb
Class Method Summary collapse
Class Method Details
.seconds_from_midnight(time) ⇒ Object
42 43 44 |
# File 'lib/opening_hours.rb', line 42 def seconds_from_midnight(time) time.hour*60*60 + time.min*60 + time.sec end |
.time_from_midnight(seconds) ⇒ Object
46 47 48 49 50 |
# File 'lib/opening_hours.rb', line 46 def time_from_midnight(seconds) hours, seconds = seconds.divmod(60 * 60) minutes, seconds = seconds.divmod(60) [hours, minutes, seconds] end |