Jump to content
Sign in to follow this  
KoolKitty Zuzu

How do I check the ms time on an object running a script?

Recommended Posts

On the page Void linked to, just click on each function for a description. But as a summary:

 

  • llGetTime() will give you a fairly fine-grained time describing how long your script has been running for, so it will start at 0.0 at the last time your script reset and continue until either the script or region resets again. You can use llResetTime() to reset this whenever you like, or llGetAndResetTime() to fetch the current time and then reset it in one go. You do however need to be careful as a region reset can ruin any timing mechanism based on these, so either plan around it, check for large negative values, or use the changed() event to detect conditions that could throw a spanner in the works.
  • llGetGMTclock() or GetWallclock() will get GMT and PDT time in seconds, bit hard to work with though IMO, but useful enough for scheduling something on a daily basis if you make sure to watch out for the values resetting at midnight in their respective timezones.
  • llGetUnixTime() is probably the most useful as it gives you a standard unix timestamp in seconds from the unix epoch, with this you can easily perform most time-related comparisons.
  • llGetDate() will get a simple date-string, though you'll have to break it apart yourself.
  • llGetTimestamp() is better than llGetDate() as it'll give you the time as well, and goes into microsecond accuracy. However it also returns a string that you'll have to parse, which means that while it is the most accurate timing mechanism we have, by the time you've processed the string into a usable form any advantage in accuracy will have been lost. You can however use llGetTime() to help you correct results, depending on what your exact requirements are.
  • llGetTimeOfDay() will get you the region time (the 4 hour SL day), llGetSunDirection() is similar as it'll tell you where the virtual sun is. These are useful for detecting night in SL regions for automated lights etc.
If you require a more precise timing mechanism then you might like to look at JIRA SCR-5 which is a proposal for a timing mechanism with milli/microsecond support, in a hopefully useful format, it's intended to avoid the problems of llGetTimestamp() which is essentially taking  an integer value, converting it to a string, and then forcing scripters to convert it back to get any use out of it.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...