title: Time difference between button presses swift
body: <p>Right now I'm working on a time clock app that allows the user to punch in/out of work time. But I'm having trouble figuring out how to make that function possible. </p>
  
  <p>In my model I have:</p>
  
  <pre><code>struct TimeLog {
  
  var punchInTime: CFAbsoluteTime
  var punchOutTime: CFAbsoluteTime
  var timeWorked: Double
  
  
  init (pInTime: CFAbsoluteTime, pOutTime: CFAbsoluteTime) {
      self.punchInTime = pInTime
      self.punchOutTime = pOutTime
      self.timeWorked = pOutTime - pInTime
  }
  
  }
  </code></pre>
  
  <p>And in my view controller:</p>
  
  <pre><code>class ViewController: UIViewController {
  
  
  override func viewDidLoad() {
      super.viewDidLoad()
      // Do any additional setup after loading the view, typically from a nib.
  }
  
  override func didReceiveMemoryWarning() {
      super.didReceiveMemoryWarning()
      // Dispose of any resources that can be recreated.
  }
  
  @IBAction func punchInButtonPressed(sender: AnyObject) {
  
  // not sure what actions are needed here to start the "aTimeLog" variable
  
  }
  @IBAction func punchOutButtonPressed(sender: AnyObject) {
  
  // not sure what actions are needed here to complete the "aTimeLog" variable
  
  }
  </code></pre>
  
  <p>I'm trying to complete this variable:</p>
  
  <pre><code>var aTimeLog = TimeLog(pInTime: //get the punch in time here, pOutTime: //get the punch out time here)
  </code></pre>
  
  <p>And once the variable "aTimeLog" is complete (the punchOutButton is pressed) I want to display a log of all of my "timeWorked" variables.</p>
  
  <p>Forgive me in advance. You might be able to tell I'm just learning programming and Swift.</p>