title: Storing timeinterval to nsuserdefaults in swift
body: <p>I am trying to save the current time of a song in the willmovefromview method so that the song can play on at the same time when scene will start again in the didmovetoview method, But I do not know what code to use to store a NSTimeinterval</p>
  
  <p>My piece of code to store and get the current time(not working: NSTimeinterval is not convertible to Int())</p>
  
  <pre><code>backgroundMusicPlayer.currentTime = NSUserDefaults.standardUserDefaults().objectForKey("musictime")
  NSUserDefaults.standardUserDefaults().setInteger(backgroundMusicPlayer.currentTime, forKey: "musictime")
  </code></pre>
  
  <p>What is the right way to do this?</p>