Setting and reseting a Timer using Python scripting

Hi there!

I’m very new to the forums, and this is my first post. Before diving into byte arrays and if statements, I would like to ask: is there a forum for newcomers? You know, the one that nobody reads, “Introduce yourself” or something?

So, I’m quite new to Python programming too, though I’ve learned the basics of computer programming 3 years ago. I’m currently prototyping in the Blender Game Engine, and, for this prototype, I would like to set up a timer that resets itself every x seconds.
It’s a music-related thing so I would like the it to be quite fast and accurate because I want some music notes to be triggered on a precise timing each time. It should be simple, yet my code doesn’t do the job.

I made a timer property called “baseTempo” that I want to reset to 0 each TempoOffset seconds. So I’ve written this:

import bge

controller = bge.logic.getCurrentController()
owner = controller.owner

print(owner, "timer property is", owner["baseTempo"], "right now!")

#^This is okay.

StartTime = owner["baseTempo"]
print("Start time is", StartTime)

#^This is okay.

TempoOffset = 5.0
print("Tempo offset is ", TempoOffset)

#^This is okay too

if (StartTime + TempoOffset) <= owner["baseTempo"]:
    StartTime = owner["baseTempo"]
    print(StartTime, "should be", TempoOffset, "times larger than the original start time")

#^This is never triggered

Blender Game Engine Started
Grid timer property is 0.01666666753590107 right now!
Start time is 0.01666666753590107
Tempo offset is  5.0
Blender Game Engine Finished

I tried to play with the if statement to see where I was wrong: I replaced the “<=” by “>”, and it worked, though it was clearly not what I wanted. I tried a “while” or an “if not” statement but I did not work.
Maybe all this is just me not understanding that the statement is checked one time only, even when connected to an Always Sensor.

What have I done wrong?