Skip to content
lsl.devlsl.devLSL Dev

LlGetUnixTime

Looking for the current API? Open the llGetUnixTime reference →

Return value notes

Returns an integer that is the number of seconds elapsed since 00:00 hours, Jan 1, 1970 UTC from the system clock (Unix time).

Caveats

  • Time codes outside 1901-12-13 20:45:52 UTC and 2038-01-19 03:14:08 UTC cannot be represented in LSL due to its use of signed 32-bit integers for Unix times. Scripts that rely on this function after January 19, 2038 may have logical errors.
    • Consider llGetTimestamp instead, which will correctly report time through 2038.
    • Lua scripts (not including LSL scripts compiled for the Luau VM) do not have this limitation with os.time(), since it returns a 64-bit number and will correctly represent time through the likely heat death of the universe.

Examples

// Reset tracker
integer BOOT_TIME;
default
{
    state_entry()
    {
        BOOT_TIME = llGetUnixTime(); 
        llSetTimerEvent(0.1);
    }
    
    timer()
    {
        llSetText((string)(llGetUnixTime() - BOOT_TIME) + " Seconds since boot.\n\n ", <1,0,0>, 1.0);
        llSetTimerEvent(1);
    }
}

Helper functions

Helper Functions:

See also: functions

Tests

Shared wiki helpers

The original page also injects shared parameter notes, caveats or issue information through these helpers. Their conditional MediaWiki logic is not reproduced here; inspect the preserved helper source for additional material.

Template:Issues/BUG-4703

Original shared helper source (conditional wiki logic is not evaluated)
{{Issues|BUG-4703|{{Wikipedia|Year 2038 problem}}|type=bug}}

Template:Issues/SVC-6357

Original shared helper source (conditional wiki logic is not evaluated)
{{Issues|SVC-6357|'''llGetUnixTimeNanos'''() - greater precision timing mechanism|type=nf}}
Original wiki source

Some wiki templates and tables need their original context. View this article on the Second Life Wiki. Technical wording and examples are retained from the source; historical guidance may differ from current behavior.