title: Calculating Time Difference
body: <p>at the start and end of my program, I have </p>
  
  <pre><code>from time import strftime
  print int(strftime("%Y-%m-%d %H:%M:%S")
  
  
  
  Y1=int(strftime("%Y"))
  m1=int(strftime("%m"))
  d1=int(strftime("%d"))
  H1=int(strftime("%H"))
  M1=int(strftime("%M"))
  S1=int(strftime("%S"))
  
  
  Y2=int(strftime("%Y"))
  m2=int(strftime("%m"))
  d2=int(strftime("%d"))
  H2=int(strftime("%H"))
  M2=int(strftime("%M"))
  S2=int(strftime("%S"))
  
  print "Difference is:"+str(Y2-Y1)+":"+str(m2-m1)+":"+str(d2-d1)\
            +" "+str(H2-H1)+":"+str(M2-M1)+":"+str(S2-S1)
  </code></pre>
  
  <p>But when I tried to get the difference, I get syntax errors.... I am doing a few things wrong, but I'm not sure what is going on...</p>
  
  <p>Basically, I just want to store a time in a variable at the start of my program, then store a 2nd time in a second variable near the end, then at the last bit of the program, compute the difference and display it. I am not trying to time a function speed. I am trying to log how long it took for a user to progress through some menus. What is the best way to do this?</p>