Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Can a timer be used reliably for long periods, like 28 days?

ArchTx Edo
Mystic/Artist/Architect
Join date: 13 Feb 2005
Posts: 1,993
10-30-2007 09:21
I have tested timer scripts that work well for 24 hours. But wondered if there might be any problem counting on them working for longer periods of time, like 28 days?

Are there any unusual lag problems related to haveing a timer counting down over that long a period of time? If there is a sim roleback or crash does the timer start over in its count down, or resume where it left off?

Here is the simple timer script I have been testing.

CODE

default
{
state_entry()
{
llSetTimerEvent(86400); //time in seconds, 24 hours: 60*60*24--no need to make LSL do this simple calculation
}

timer()
{
llSay(0, "24 hour timer has expired");
llGiveInventory("avatar or object key number", "Note");
llInstantMessage("key user", "24 hour timer has expired");
//Sends an Instant Message to the user specified by key.
}
}


_____________________

VRchitecture Model Homes at http://slurl.com/secondlife/Shona/60/220/30
http://www.slexchange.com/modules.php?name=Marketplace&MerchantID=2240
http://shop.onrez.com/Archtx_Edo
Daten Thielt
Registered User
Join date: 1 Dec 2006
Posts: 104
10-30-2007 10:47
Its reliability all depends on the sim, if the sim goes down the script is gona reset and start over most likley, to make it totaly reliable u could get it to store the time in the objects description and pickup where it left off on state entry
Tyken Hightower
Automagical
Join date: 15 Feb 2006
Posts: 472
10-30-2007 11:06
I've never tested how accurate long-term timers are, and while I suspect they adjust to changes in script time and lag, it's possible to do it more accurately. What I would do is use timers to check whether you've passed a certain second returned by llGetUnixTime.
_____________________
Django Yifu
Beat Island Gaffer
Join date: 7 May 2007
Posts: 189
10-30-2007 12:08
I agree with Tyken on this. I would use some sort of time check agains an infalible source. Wallclock, GMT Timestamp etc and use a shorter timer to check against that stored time. You might even set up a more accurate timer as you get closer to the deadline to be sure you hit it on the second.

Something like

if (deadline - current time <= 300)//if 300 is seconds
1 minute timer

if (deadline - current time <= 10)//if 10 is seconds
1 second timer

Excuse the seudo code but i just wanted to make the point not the actual script.
_____________________
Tread softly upon the Earth for you walk on my face.
Nika Talaj
now you see her ...
Join date: 2 Jan 2007
Posts: 5,449
10-30-2007 12:16
The more common "timeclock" scripts used to keep track of employee hours in SL lose significant time during periods of lag. I have never checked to see if there was an arithmetic relationship to measured "Time Dilation" ... .

So I also recommend periodic recalibrating to a known good time source.
Johan Laurasia
Fully Rezzed
Join date: 31 Oct 2006
Posts: 1,394
10-31-2007 02:33
Yeah, your best bet is to use a timer to read SL time using llGetWallclock(), and llGetDate(), and compare that against a hard coded time, or better yet, setup a notecard with the time and date, and read that from a notecard. Even in a rock solid sim that 'never goes down', it's still going to go down once a month (or more) in a rolling restart, as SL seems to have approx. one rolling restart a month (at least).