[Solved] Weird if Statement/System.out behavior

Misc.log("Update");
if (time >= 1000) {
	Misc.log("Time");
}

where Misc has this function:

public static void log(String msg) {
	Date date = new Date();
	System.out.println("[" + new Timestamp(date.getTime()) + "] " + msg);
}

Time is a float that increses with my delta time (which is calculated in millieseconds) so after one second it should pass into the if state as well (it’s in my game loop)

I tested it with outputs to see what in my code isn’t working.

with both Misc.log(); calls arround the if statement both get called, however if I remove the Misc.log(“Update”); it doesn’t ever output “Time” in my console, nothing else changed, why is this and how can i fix it? :confused:
Without both the code inside that if() doesn’T get called either

That’s something you’re going to have to use a debugger for and figure out on your own. Its not something we can take a look at and be like, oh here’s the issue because its messing up somewhere else in your code. Using a debugger is super easy!

alright, gonna do that ::slight_smile:

figured out time was a long and the delta value that gets added a float, without the Misc.log it’s running under 1ms per update which keeps the long to 0 and with the Misc.log it’s a bit above 1ms :cranky: wow

changed the time variable to be a float as well