title: Having trouble trying to subtract a number from a date/time and setting that value in a textField
body: <p>I am working on an app that has a startTime, endTime and duration. The user can set the endTime by click a button and it sets the value to "now" in the format 12:02:03 PM.  I then want to be able to enter a duration time in minutes, let's say 20 minutes.</p>
  
  <p>I have everything working where I can read the duration in real time as well as see the current time.  The issue is when I try to create a function to subtract the duration from the endTime. I cannot seem to get the syntax or the formatting correct. </p>
  
  <p>I've done quite a bit of searching for examples of this. Here is what I came across so far.</p>
  
  <p><a href="https://stackoverflow.com/questions/29465205/how-to-add-minutes-to-current-time-in-swift">How to add minutes to current time in swift</a></p>
  
  <p><a href="https://stackoverflow.com/questions/41394817/how-to-subtract-date-components">How to subtract date components?</a></p>
  
  <p><a href="https://stackoverflow.com/questions/24070450/how-to-get-the-current-time-as-datetime">How to get the current time as datetime</a></p>
  
  <pre><code>func controlTextDidChange(_ obj: Notification) {
      let enteredValue = obj.object as! NSTextField
      timeString(time: enteredValue.doubleValue)
  }
  
  func timeString(time: TimeInterval) {
      formatter.dateFormat = "yyyy-MM-dd HH:mm:ss"
      let myString = formatter.string(from: Date())
      let yourDate = formatter.date(from: myString)
      formatter.dateFormat = "hh:mm:ss a"
      yourDate!.addingTimeInterval(0-time)
      let wtf = formatter.string(from: yourDate!)
      startTime.stringValue = wtf
  }
  </code></pre>
  
  <p>The <code>controlTextDidChange</code> function is watching the <code>durationTextField</code> and I am able to print to console the input. I then want to be able to run the <code>timeString</code> function with the <code>durationTextField</code> value and subtract it from the <code>endTime</code> and then set that value to <code>startTime</code>.  </p>
  
  <p>One thing that is weird is Xcode tells me:</p>
  
  <blockquote>
    <p>Result of call to 'addingTimeInterval' is unused</p>
  </blockquote>