LlGetTimeOfDay: Difference between revisions

From Second Life Wiki
Jump to navigation Jump to search
No edit summary
m add hyphen
 
(6 intermediate revisions by 4 users not shown)
Line 5: Line 5:
|func_energy=10.0
|func_energy=10.0
|return_type=float
|return_type=float
|func_footnote=Second Life days cycles are 4 hours long (3 hours of light, 1 hour of dark). The sunrise and sunset time varies slowly (following the seasons?).
|func_footnote=By default (without custom environment settings), Second Life day cycles are 4 hours long, but can be configured to anywhere between 4 and 168 hours long.
|func_desc
|func_desc
|return_text=that is the time in seconds with subsecond precision since Second Life server midnight (or since server boot; whichever is smaller).
|return_text=that is the time in seconds with sub-second precision since Second Life midnight (per the parcel-scoped day cycle settings).
|spec
|spec
|caveats
|caveats
|constants
|constants
|examples
|examples=<source lang="lsl2">default
{
    touch_start(integer total_number)
    {
        float tod = llGetTimeOfDay( );
        llOwnerSay("Time since midnight on current parcel:");
        integer hours = ((integer)tod / 3600) ;
        integer minutes = ((integer)tod / 60) - (hours * 60);
        llOwnerSay((string) tod + " seconds which is "+(string) hours+"h "+(string) minutes+"m");
    }
}</source>
|helpers
|helpers
|also_functions=
|also_functions=
{{LSL DefineRow||[[llGetSunDirection]]|}}
{{LSL DefineRow||[[llGetSunDirection]]|}}
{{LSL DefineRow||[[llGetRegionTimeOfDay]]|}}
|also_events
|also_events
|also_tests
|also_tests

Latest revision as of 09:48, 22 July 2026

Summary

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

Returns a float that is the time in seconds with sub-second precision since Second Life midnight (per the parcel-scoped day cycle settings).

By default (without custom environment settings), Second Life day cycles are 4 hours long, but can be configured to anywhere between 4 and 168 hours long.

Examples

default
{
    touch_start(integer total_number)
    {
        float tod = llGetTimeOfDay( );
        llOwnerSay("Time since midnight on current parcel:");
        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
•  llGetRegionTimeOfDay

Deep Notes

Signature

function float llGetTimeOfDay();