I'm trying to create a simple game using pygame and everything was ok so far. The last couple of days though I realized that a problem occurred with the time.clock(). I read the documentation and the function should count the time of the game since it starts. I wanted to spawn an alien group every 8 seconds and it worked(I'm working on debian os) but as I mentioned the last 2 days it doesn't count properly. The system needs about 20 seconds in real time in order for time.clock to print 8.0 and the aliens to spawn and at first I thought that I messed up with the counters but how can this be, It worked fine in the beginning so I tried to run the same code on the windows partition and it was also fine. So is this a problem with the system clock or anything else? I replaced the time.clock on debian with time.time and also worked fine. Did anyone in the past run into the same problem? Can you help me check if something else is the problem(both operating systems run python 3.6)? If you don't understand something or need anything more just ask me.
Thank you for your time
here is a portion of the time.clock use in the game:
sergeant_spawn_time_limit = 8.0
sergeant_spawn_time = 0.0
if game_stage == 2 or game_stage == 3 or score >= 400:
if time.clock() - sergeant_spawn_time > sergeant_spawn_time_limit:
for spawn_sergeant in range(5):
sergeant = AlienSergeant(display_width, display_height, 50, 88)
all_sprites_list.add(sergeant)
alien_sergeant_list.add(sergeant)
sergeant_spawn_time = time.clock()