class ReeDatetime::Change

def call(date_time, **opts)

def call(date_time, **opts)
  if opts[:nsec]
    raise ArgumentError, "Can't change both :nsec and :usec at the same time" if opts[:usec]
    new_fraction = Rational(opts[:nsec], 1000000000).to_f
    raise ArgumentError, "argument out of range" if new_fraction >= 1
  elsif opts[:usec]
    new_fraction = Rational(opts[:usec], 1000000).to_f
    raise ArgumentError, "argument out of range" if new_fraction >= 1
  end
  DateTime.new(
    opts[:year] || date_time.year,
    opts[:month] || date_time.month,
    opts[:day] || date_time.day,
    opts[:hour] || date_time.hour,
    opts[:min] || date_time.min,
    (opts[:sec] || date_time.sec).to_f + (new_fraction || 0),
    opts[:offset] || date_time.offset
  )
end