Custom Timers with Independent DeltaTime/TimeScale/etc.

I’m trying to implement a custom timer class that uses different timezones (menu, gui, game, etc.) with independent Time.time, Time.deltaTime and Time.timeScale values.

At first I was calling CustomTimer.Update() each frame and using the difference between the last and current frame’s Time.realTimeSinceStartup to calculate the frame’s deltaTime and using it to populate the independent timers time/deltaTime properties.

But given that Time.realTimeSinceStartup is a float, I thought I should google for potential precision issues, and I came across this on the Unity docs:

Is there a more reliable way to go about calculating independent time/deltaTime values? Also, can I get the internal doubles from the Time class instead of the less precise floats?

What about using .NET Stopwatch class

The solution I was after, thanks :smile: