SaveData and starting .exe on boot raspberry pi

So I exported my project as an .exe and it automatically starts on boot perfectly, however the saveData portion of my code doesn’t save every hour like it should.

Strangely enough though, if I start the program myself instead of letting it auto boot, the saveData every hour works. I’ve also let it auto boot, then I give it a few random clicks, and then saveData works. To be clear, nothing in my code require click events. It is all keyboard related.

It’s almost like it requires me to focus the program with a click? How would I be able to focus the program automatically on boot?

My only other idea is that the hour() part of my code is somehow null when it start the program on boot. Does that sound like something that is possible? If so, I know how to fix that.

Anyway, I’m curious if anyone has had this problem or has any other ideas on how to fix it.

A simplified version of my code is this:

int saveTimer = hour();

void draw() {
if (saveTimer < hour()) {
saveData();
saveTimer = hour();
}
}