The RealTimeSince struct in the Sandbox
namespace is a utility for measuring the time elapsed since a specific event occurred. It is based on the global time provided by RealTime.GlobalNow
. This struct is particularly useful for scenarios where you need to track the duration since an event, such as a user action or a game event.
To use RealTimeSince, you typically initialize it to zero to reset the timer. The struct then provides the elapsed time since the last reset. For example:
RealTimeSince lastUsed = 0;
if ( lastUsed > 10 ) { /* Do something */ }