title: How can i make a time counter using QTime()
body: <p>I am trying to do a time counter in <code>python</code> using <code>QTime</code> and show this time in a <code>QLabel</code> using <code>PyQt</code>. I need to do this, to show how many time has passed since my program started to work, using this format of time: <code>00:00:00</code>. I read the docs of <code>QTime</code> and tried another code that I have searched for on the internet, but I can not make it work. </p>
  
  <p>This is part of my code:</p>
  
  <pre><code>class MyApplication(QtGui.QApplication):
    def __init__(self, *args, **kwargs):
      super(MyApplication, self).__init__(*args, **kwargs)
  
      self.t = QTime()                      #I start QTime at the same time
      self.t.start()                        # the program starts.
  
      self.label_1 = QtGui.QLabel("Time since the program started:")
  
      self.time_label = QtGui.QLabel("00:00:00")
  
      self.tmr = QTimer()                   #I use QTimer because I need it 
                                            #for another part of the code
      self.tmr.timeout.connect(self.clock)
  
    def clock(self):
      self.m = 0
      self.elapsed = self.t.elapsed()
  
      self.s = int((self.elapsed)/1000)
      if self.s == 60:
          self.m += 1
          self.s = 0 
  
      self.time_sec = str(self.s)
      self.time_min = str(self.m)
      self.time = self.time_min + ":" + self.time_sec
  
      self.time_label.setText(self.time)     #I show the time in this QLabel()
  </code></pre>
  
  <p>When I build this, I get this format of time: <code>0:0</code> and after 60 seconds (it shows the seconds) I get this result: <code>1:0</code>, and nothing else happens. </p>
  
  <p>How can I make the time counter that I need with this format: <code>00:00:00</code>. Can I do it using <code>QTimer</code>? Hope you can help me.</p>
  
  <h2>------ EDIT ------</h2>
  
  <p>Thanks to @amicitas and @linusg answer, I´ve tried the <code>datetime</code> module, and wrote this simple code:</p>
  
  <pre><code>class MyApplication(QtGui.QApplication):
    def __init__(self, *args, **kwargs):
      super(MyApplication, self).__init__(*args, **kwargs)
  
      self.t0 = datetime.now()
  
      self.tmr = QTimer()                   
      self.tmr.timeout.connect(self.clock)
  
  
    def.clock(self):
      self.t1 = datetime.now()
  
      self.hour = self.t1.hour - self.t0.hour
      self.minute = self.t1.minute - self.t0.minute
      self.second = self.t1.second - self.t0.second
  
      print self.hour, self.minute, self.second
  </code></pre>
  
  <p>But, when I build this, at the moment the counter reaches 45 seconds, it turns 45 to -15 and "1 minute" appears. This is:</p>
  
  <p>When it reaches <code>0:0:44</code>, it turns to <code>0:1:-15</code>.</p>
  
  <p>What could be the problem? And how can I show the time format that I need? This is <code>00:00:00</code>. Hope you can help me.</p>