Difference between revisions of "LlGetTimeOfDay"
Jump to navigation
Jump to search
Gigs Taggart (talk | contribs) m (LSL llGetTimeOfDay moved to LlGetTimeOfDay) |
(Made some edits to reflect how this function operates under custom environment settings) |
||
(14 intermediate revisions by 5 users not shown) | |||
Line 1: | Line 1: | ||
{{LSL_Function | {{LSL_Function | ||
|func_id=80|func_sleep=0.0|func_energy=10.0 | |func=llGetTimeOfDay | ||
|func_id=80 | |||
|func_footnote | |func_sleep=0.0 | ||
|func_energy=10.0 | |||
|return_type=float | |||
|func_footnote=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. | |||
|func_desc | |func_desc | ||
|return_text=that is the time in seconds since Second Life | |return_text=that is the time in seconds with subsecond precision since Second Life midnight (per the parcel-scoped day cycle settings) or region up-time (time since when the region was brought online/rebooted); whichever is smaller. If the parcel 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= | ||
{{LSL DefineRow||[[llGetSunDirection]]|}} | |||
{{LSL DefineRow||[[llGetRegionTimeOfDay]]|}} | |||
|also_events | |also_events | ||
|also_tests | |also_tests | ||
|also_articles | |also_articles | ||
|notes | |notes | ||
|cat1=Time | |cat1=Time | ||
|cat2 | |cat2=Region | ||
|cat3 | |cat3 | ||
|cat4 | |cat4 | ||
}} | }} |
Latest revision as of 10:46, 29 August 2023
LSL Portal | Functions | Events | Types | Operators | Constants | Flow Control | Script Library | Categorized Library | Tutorials |
Summary
Function: float llGetTimeOfDay( );80 | Function ID |
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 parcel-scoped day cycle settings) or region up-time (time since when the region was brought online/rebooted); whichever is smaller. If the parcel 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.
Caveats
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 | |||
• | llGetRegionTimeOfDay |