LSL Wiki Mirror 7-7-7 : llGetAndResetTime

HomePage :: PageIndex :: RecentChanges :: RecentlyCommented :: UserSettings ::
float llGetAndResetTime()

Gets the time in seconds since the last script reset (or the last call to this function or llResetTime) and resets the time to zero. This offers greater precision than calling llGetTime and llResetTime separately.

Example:
default
{
    touch_start( integer total_number )
    {
        float elapsed = llGetAndResetTime();
        float deadline = 10.0;

        if ( elapsed >= deadline )
            llWhisper( 0, "I'm sorry, you were too slow: " 
                          + (string)elapsed 
                          + " seconds" );       
        else 
            llWhisper( 0, "Yay!  You beat the deadline by " 
                          + (string)(deadline - elapsed)
                          + " seconds" );
    }
}


Functions | Time
There is no comment on this page. [Display comments/form]