float llGetTimeOfDay()
Gets the
Second Life time. Time in Second Life passes at the same speed as in the real world, but the day is normally only 4 hours long. See
llGetSunDirection for a detailed description of the Second Life day.
When a
sim is rebooted, the
value of
llGetTimeOfDay is set to zero. It then proceeds to increase by 1 as every second passes so that, initially, it expresses the number of seconds that have passed since the sim was rebooted. The value of
llGetTimeOfDay is also set to zero when the sun passes its midnight position (see
llGetSunDirection). This means, in normal circumstances,
llGetTimeOfDay will show time since reboot for up to four hours and, thereafter, show time since sim midnight. Assuming that a sim is not rebooted very often,
llGetTimeOfDay will therefore usually return the number of seconds since sim midnight, but cannot be relied on to do so.
Owners of private islands have the ability to lock the sun's
position; in these locations,
llGetTimeOfDay will never be
reset by the sun passing its midnight position, and
llGetTimeOfDay will always show time since sim reboot, increasing without limit. The
Lindens also have the ability to lock the sun over the whole
world and, in
SL 1.5.1, the sun was accidentally locked in one position for several days.
If you are trying to determine whether it is night- or daytime (to activate a light source at night only, for example), you could simpy test if the result of
llGetTimeOfDay is larger than 3600 (1 hour in seconds). But the function's behaviour after each sim reboot makes it too unreliable. Using
llGetSunDirection provides a more accurate way (see the script example at the bottom of the
llGetSunDirection page).
Note:
llGetTimeOfDay,
llGetTime, and
llGetWallclock do different things.
This article wasn't helpful for you? Maybe the
related article at the LSL Portal is able to bring enlightenment.
Functions |
Time