The TimeSince struct in the Sandbox
namespace is a utility for measuring the time elapsed since a particular event. It is based on the current time as provided by Time.Now
. This struct is particularly useful for timing operations or events in a game environment.
To use TimeSince, you typically initialize it to zero to start the timer. The struct then provides the time elapsed since this initialization. For example:
TimeSince lastUsed = 0;
if ( lastUsed > 10 ) {
// Do something
}