Is there any proper way to create and display a timer in java using only java sdk and libraries from libGDX?
I want my timer to start from zero and to be displayed in a format like minutes : seconds.
I am currently using workarounds like adding the delta time in render method and casting totalTime / 60 to integer for minutes and totalTime - minutes * 60 for seconds.
Before this I have tried adding the delta to seconds and having an if in the render method which sets seconds to 0 and increases minutes by 1 when seconds >= 59.9f. Both methods are very inefficient and not very accurate. My timer skips seconds when it approaches the end of a minute or it shows 60 seconds and then increases minutes and resets seconds, something like 1:59, 1:60 and then 2:00.
I searched all over the documentations and internet and not have found a way to properly display time (not workarounds that have huge flaws). How can you do this in a professional manner?
I don't think AAA games do this stuff seriously... Has anyone even thought that people might need something like a countdown timer in java or in libGDX (one that works without displaying 1:60 at least)?