Difference between revisions of "LlGetTimeOfDay"

From Second Life Wiki
Jump to navigation Jump to search
m (<lsl> tag to <source>)
(5 intermediate revisions by 3 users not shown)
Line 5: Line 5:
|func_energy=10.0
|func_energy=10.0
|return_type=float
|return_type=float
|func_footnote
|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.
|func_desc
|func_desc
|return_text=that is the time in seconds with subsecond precision since Second Life server midnight (or since server up-time; whichever is smaller)
|return_text=that is the time in seconds with subsecond precision since Second Life midnight 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.
|spec
|spec
|caveats
|caveats
|constants
|constants
|examples
|examples=<source lang="lsl2">//Time will be less than 4 hours unless the sun is locked.
default
{
    touch_start(integer total_number)
    {
        float tod = llGetTimeOfDay( );
        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");
    }
}</source>
|helpers
|helpers
|also_functions=
|also_functions=

Revision as of 03:04, 22 January 2015

Summary

Function: float llGetTimeOfDay( );

Returns a float that is the time in seconds with subsecond precision since Second Life midnight 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.

Second Life days 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 = llGetTimeOfDay( );
        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

Deep Notes

Search JIRA for related Issues

Signature

function float llGetTimeOfDay();