Time
A script measures and waits for time in a few distinct ways: a repeating timer that raises an event, a sleep that pauses the script, a script clock that counts how long the script has been running, and real-world clocks in UTC and Second Life Time. Regions also have an environmental time of day that follows the day cycle, which is not the same as the clock. Time interacts with the event model: a timer is an event like any other and waits its turn in the queue.
Concepts in time
- Each script has one timer, which raises the
timerevent at most once every sec seconds- Passing
0.0stops further timer events - Setting a new timer replaces the old one and resets the timer clock, so calling it again more often than sec means the timer never fires
- The timer survives state changes, but does not survive resets
- Timer events can arrive late, because of time dilation, the default event delay, a long-running event or
llSleep. Thetimerevent is not an interrupt; the current event finishes first
- Passing
- A script can
sleepfor a number of seconds, and does nothing during that time - Script time counts how long the script has been running, with subsecond precision
- It is unaffected by time dilation, but does not count time while the script is suspended, the object is in inventory, or the wearer is offline
- It restarts when the script is reset, or
explicitly, or when read and reset in one call - In LSL its accuracy falls as the value grows, so reset it whenever practical
- Real-world time comes from the system clock
- Unix time in whole seconds, an ISO 8601 timestamp and the
date, all in UTC - Seconds since midnight Pacific Time, which is Second Life Time (SLT), or
GMT
- Unix time in whole seconds, an ISO 8601 timestamp and the
- Environmental time follows the day cycle of the
parcelor theregion, with its day length andoffset. See Environments for the sky itself - Time dilation is how the region copes with lag: it slows script time and execution, from 1.0 (none) down to 0.0, when script execution halts
- A script can set the minimum delay between events it handles
Timer and clock functions
void | llSetTimerEvent(float sec) |
event | timer() |
void | llSleep(float sec) |
void | llMinEventDelay(float delay) |
float | llGetTime() |
void | llResetTime() |
float | llGetAndResetTime() |
integer | llGetUnixTime() |
string | llGetTimestamp() |
string | llGetDate() |
float | llGetWallclock() |
float | llGetGMTclock() |
float | llGetTimeOfDay() |
float | llGetRegionTimeOfDay() |
float | llGetRegionTimeDilation() |
Dates after 2038
llGetUnixTime returns a signed 32-bit integer, so it cannot represent times after 2038-01-19 03:14:08 UTC. llGetTimestamp will correctly report time through 2038.
Time functions in detail
Timers and delays
Section titled “Timers and delays”void | llSetTimerEvent(float sec)Cause the timer event to be triggered a maximum of once every sec seconds. Passing in 0.0 stops further timer events |
event | timer()Triggered at the interval set with llSetTimerEvent. Only one timer can be active at one time |
void | llSleep(float sec)Puts the script to sleep for sec seconds. The script will not do anything during this time |
void | llMinEventDelay(float delay)Set the minimum time between events being handled. The minimum delay is maintained between state changes |
Script time
Section titled “Script time”float | llGetTime()Returns script time in seconds with subsecond precision since the script started, was last reset, or call to either llResetTime or llGetAndResetTime |
void | llResetTime()Resets the script time to zero |
float | llGetAndResetTime()Returns script time in seconds and then resets the script time to zero |
Clocks
Section titled “Clocks”integer | llGetUnixTime()Returns the number of seconds elapsed since 00:00 hours, Jan 1, 1970 UTC from the system clock |
string | llGetTimestamp()Returns the current date and time in the UTC time zone in the ISO 8601 format "YYYY-MM-DDThh:mm:ss.ff..fZ". Appears to be accurate to milliseconds |
string | llGetDate()Returns the current date in the UTC time zone as "YYYY-MM-DD" |
float | llGetWallclock()Returns the time in seconds since midnight Pacific time (PST/PDT), truncated to whole seconds. That is the same as the time of day in SLT expressed as seconds |
float | llGetGMTclock()Returns the time in seconds since midnight GMT, truncated to whole seconds |
Environmental time and dilation
Section titled “Environmental time and dilation”float | llGetTimeOfDay()Returns the seconds since parcel environmental midnight, or region uptime if that is smaller or the parcel’s sun is fixed |
float | llGetRegionTimeOfDay()Returns the seconds since region environmental midnight, or region uptime if that is smaller or the region’s sun is fixed |
float | llGetRegionTimeDilation()Returns the current time dilation, from 0.0 (full dilation) to 1.0 (no dilation). It is used as the ratio between the change of script time to that of real world time |
Additional
llGetDayLength,llGetDayOffset— Seconds in the parcel’s day cycle, and the offset added to compute its environmental timellGetRegionDayLength,llGetRegionDayOffset— The same for the whole region
llGetRegionTimeDilation— Region idling lowers a region’s framerate when no avatars are on or looking into it, so an idle region may report significant time dilationllGetRegionFPS— Average simulator frames per second
llGetInventoryAcquireTime— When an item was placed in the prim, as a UTC timestampllResetScript— Clears the timer, along with repeating sensors and listeners. See Scripts
Related
Section titled “Related”See also Feature EventsFeature ScriptsFeature EnvironmentsCategory Time
Adapted from the Second Life Wiki pages LlSetTimerEvent (revision 1214214, 2023-07-05), Timer (revision 1194108, 2015-01-22), LlSleep (revision 1217326, 2024-09-22), LlMinEventDelay (revision 1212509, 2022-10-01), LlGetTime (revision 1218600, 2026-01-31), LlGetAndResetTime (revision 1218526, 2025-11-30), LlGetUnixTime (revision 1218796, 2026-04-20), LlGetTimestamp (revision 1217942, 2025-02-01), LlGetWallclock (revision 1214560, 2023-09-06) and LlGetRegionTimeDilation (revision 1218444, 2025-08-30), including the transcluded Template:Issues/SVC-3293 (revision 1155854, 2011-10-17), Template:Issues/BUG-4703 (revision 1185042, 2013-12-13) and Template:Issues/SVC-6357 (revision 1057662, 2010-10-09); history, by Second Life Wiki contributors, under CC BY-SA 3.0. Last wiki edit: .