You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: duration.rb
    path of file: ./repos/ekylibre/app/models/accountancy
    
    the code of the file until where you have to start completion: # frozen_string_literal: true

module Accountancy
  class Duration
    class << self
      def diff(start, stop)
        safe_diff(*[start, stop].sort)
      end

    
    
        def safe_diff(start, stop)
          return 0 if start == stop

          year_diff = stop.year - start.year
          months_diff = stop.month - start.month

          day1 = [30, start.day].min
          day2 = [30, stop.day].min
          day_diff = day2 - day1

          year_diff * 12 * 30 + months_diff * 30 + day_diff
        end