lib/working_time/interval.rb
def seconds_between(start, stop)
 
    # we need this to be a float   
    duration = 0.0
  
    # we just return if the start comes after the stop
    return duration if start > stop

    # If it's a weekday, examine it.
    if WORKING_DAYS.include? start.wday

      # If it's inside working hours, calculate
      if WORKING_HOURS.include? start.hour

        # Figure out how many seconds between now and then
        hours, mins, secs, ignore_fractions = Date::day_fraction_to_time(stop - start)
        duration = hours * 60 * 60 + mins * 60 + secs

      end

    end

    return duration
  end
# Calculates the number of seconds in a work day between two times in the same day
Calculates the number of seconds in a work day between two times in the same day
Calculates the number of seconds in a work day between two times in the same day
def seconds_between(start, stop)
    duration = 0.0
    return duration if start > stop
    if WORKING_DAYS.include? start.wday
      if WORKING_HOURS.include? start.hour
        hours, mins, secs, ignore_fractions = Date::day_fraction_to_time(stop - start)
        duration = hours * 60 * 60 + mins * 60 + secs
      end
    end
    return duration
  end
def seconds_between ( start , stop ) duration = 0.0 return duration if start > stop if WORKING_DAYS . include? start . wday if WORKING_HOURS . include? start . hour hours , mins , secs , ignore_fractions = Date :: day_fraction_to_time ( stop - start ) duration = hours * 60 * 60 + mins * 60 + secs end end return duration end
Calculates the number of seconds in a work day between two times in the same day
Calculates the number of seconds in a work day between two times in the same day
# we need this to be a float    # we just return if the start comes after the stop # If it's a weekday, examine it. # If it's inside working hours, calculate # Figure out how many seconds between now and then
start
stop