Best way to create a timer 00:00:00 (Minutes, Seconds, Milliseconds)?

Have you tried the system in Epic’s Time Attack Racer tutorial series? It is the same as the one in the link but it uses a Timeline instead of Game Time in Seconds so that may work.

I’ve been looking into creating a timer for my projects but haven’t found specifically what I’m looking for. I want to create something like a racing game timer where even milliseconds are very important. (00:00:00)

I’ve found this question: Timer but is there a way to get the same effect using a timespan? I have been looking into them but have found no tutorial on how to properly use them.

Can anyone help?

Did not know about that tutorial set, thanks Jacky i’ll have a look!

Is this the best way to make a timer in UE at the moment?

I dont know if it is the best way really. I also made a clock system with timers recently and it has its own advantages/disadvantages so you can go with whichever suits your needs as long as it works i think. :slight_smile:

I would store the time as a float variable since comparisons are faster but display it as a timespan using a float to timespan macro. Just drag from a float pin and type “minutes” or “seconds”.

I ended up using both of the links to make it. I used the [Race Timer][1] video for the whole system, but the problem is it only goes to a total of 999 seconds. So I took the get game time in seconds part out of [this][2] answer. This has given me a much more accurate timer than the botch job I had before. Thanks everyone!

Thank you, very useful. Timespans were giving me some problems but this fixed it.

Just in case someone has any problems there, first node shows Time / 0 that’d kill Unreal’s maths, causing the minutes not to show, change that 0 for 60 and minutes working as a charm. Time / 60

For any who are still trying to figure this out, I have created a custom actor component that will output this format automatically. Simply add the component to any blueprint you want and call the function. Everything else is taken care of under the hood.