# llGetAndResetTime

*LSL function*

```lsl
float float llGetAndResetTime();
```

- Returns: `float`
- Energy: 10

Returns the elapsed script time in seconds as a float, then resets the script timer to zero.

Returns a [float](https://wiki.secondlife.com/wiki/float) that is script time in seconds and then resets the script time to zero.

```lsl title="How to use" frame="terminal"
float result = llGetAndResetTime();
```

## Specification

Script time is the amount of time the script has been running since it first started, was most recently reset, or one of the reset functions was called. It is unaffected by time dilation.

## Caveats

- Script time is the amount of real-world time that the script has been in a running state. It is unaffected by time dilation, but it does not count time while the script is suspended, the user is offline (when in an attachment), the object is in inventory rather than rezzed, etc.
- Script time resets when...
- Script reset (user or [llResetScript](/functions/llResetScript/) or [llResetOtherScript](/functions/llResetOtherScript/))
- Call to either [llResetTime](/functions/llResetTime/) or [llGetAndResetTime](/functions/llGetAndResetTime/)
- Due to (32 bit) floating point number limitations, the accuracy of this function is 1/32sec up to ~3 days, 1/16sec up to ~6 days, etc... doubling each time, e.g. it's only 1 second at ~194 days. Use [llResetTime](/functions/llResetTime/) or [llGetAndResetTime](/functions/llGetAndResetTime/) whenever practical to maintain the accuracy you require.

## Examples

<details open>
<summary>Example 1</summary>

```lsl
default
{
    touch_start(integer num_touch)
    {
        // This is equivalent to calling llGetTime(), then llResetTime()
        float time = llGetAndResetTime();

        llSay(0, (string)time + " seconds have elapsed since the last touch or script start.");
    }
}
```

</details>

## Known issues

- [SVC-3293](https://jira.secondlife.com/browse/SVC-3293): [llGetTime](/functions/llGetTime/) doesn't reset on admin requested sim restart

## See also

### Functions

- [llResetTime](/functions/llResetTime/)
- [llGetTime](/functions/llGetTime/)
- [llGetRegionTimeDilation](/functions/llGetRegionTimeDilation/)

---

*Source: [LlGetAndResetTime](https://wiki.secondlife.com/wiki/LlGetAndResetTime) on the Second Life Wiki. Content from the Second Life Wiki article LlGetAndResetTime (revision 1218526, 2025-11-30), CC BY-SA 3.0.*

---

From lsl.dev: https://lsl.dev/functions/llGetAndResetTime/
