Difference between revisions of "LSL llGetTime"

From Second Life Wiki
Jump to navigation Jump to search
Line 14: Line 14:
     state_entry()
     state_entry()
     {
     {
    llResetTime();
        llResetTime();
     }
     }
     touch_start(integer num_touch)
     touch_start(integer num_touch)
     {
     {
    float time;
        float time;
    time=llGetTime(); //Instead getting, and then resetting the time, we could use llGetAndReset() to accomplish the same thing.
        time=llGetTime(); //Instead getting, and then resetting the time, we could use llGetAndReset() to accomplish the same thing.
    llResetTime();
        llResetTime();
    llSay(0,(string)time + " seconds have elapsed since the last touch." );
        llSay(0,(string)time + " seconds have elapsed since the last touch." );
     }
     }
}
}

Revision as of 13:59, 9 February 2007

Summary

Function: float llGetTime( );

Returns a float time in seconds.

Retrieves the time in seconds since the last script reset, or since the last call to llResetTime/llGetAndResetTime.

Caveats

Known to be reset by various events outside user control, such as sim resets. Reliable only for short term timing measurements.

All Issues ~ Search JIRA for related Bugs

Examples

<lsl> default {

   state_entry()
   {
       llResetTime();
   }
   touch_start(integer num_touch)
   {
       float time;
       time=llGetTime(); //Instead getting, and then resetting the time, we could use llGetAndReset() to accomplish the same thing.
       llResetTime();
       llSay(0,(string)time + " seconds have elapsed since the last touch." );
   }

}

</lsl>

See Also

Deep Notes

Search JIRA for related Issues

Signature

function float llGetTime();