Difference between revisions of "LlGetRegionTimeOfDay"

From Second Life Wiki
Jump to navigation Jump to search
(This function was created years ago but didn't have a wiki page)
 
m
 
Line 26: Line 26:
|also_functions=
|also_functions=
{{LSL DefineRow||[[llGetSunDirection]]|}}
{{LSL DefineRow||[[llGetSunDirection]]|}}
{{LSL DefineRow||[[llGetTimeOfDay]]|}}
|also_events
|also_events
|also_tests
|also_tests

Latest revision as of 10:45, 29 August 2023

Summary

Function: float llGetRegionTimeOfDay( );
0.0 Forced Delay
10.0 Energy

Returns a float that is the time in seconds with subsecond precision since Second Life midnight (per the region-scoped day cycle settings) or region up-time (time since when the region was brought online/rebooted); whichever is smaller. If the region is configured so the sun stays in a constant position, then the returned value is the region up-time.

By default (without custom environment settings), Second Life day cycles are 4 hours long (3 hours of light, 1 hour of dark). The sunrise and sunset time varies slowly.

Examples

//Time will be less than 4 hours unless the sun is locked.
default
{
    touch_start(integer total_number)
    {
        float tod = llGetRegionTimeOfDay( );
        llOwnerSay("Time since last region restart or SL midnight (based on SL 4 hour day):");
        integer hours = ((integer)tod / 3600) ;
        integer minutes = ((integer)tod / 60) - (hours * 60);
        llOwnerSay((string) tod + " seconds which is "+(string) hours+"h "+(string) minutes+"m"); 
    }
}

See Also

Functions

•  llGetSunDirection
•  llGetTimeOfDay

Deep Notes

Signature

function float llGetRegionTimeOfDay();