title: Programming time in Python
body: <p>I want to program time that is independent and runs by itself in the background and ticks every second, and automatically changes Date every 24 seconds (1 second = 1 hour)</p>
  
  <pre><code>def PrintTime():
      D = 1
      M = 1
      Y = 2019
      print(D,"/",M,"/",Y)
      Time = 0
      while Time &lt; 24:
          Time += 1
          time.sleep(1)
          if Time == 24:
              Time = 0
              D += 1
              M += 1
              if M in list[2,4,6,9,11] and D &gt; 30:
                  D = 1
              if M in list[1,3,5,7,8,10,12] and D &gt; 31:
                  D = 1
              if M &gt; 12:
                  M = 1
                  Y += 1
  </code></pre>
  
  <p>This is the idea I had in mind, but the problem with this is the whole program would be sleeping every second, which is what I don't want to happen. Instead I want to run this by itself, in the background, without bothering the rest of the program.</p>